LPgenerator / mattermost_bot

MatterBot - A chat bot for MatterMost (http://www.mattermost.org).
MIT License
211 stars 60 forks source link

Make bot only respond to whispers #15

Closed Grokzen closed 8 years ago

Grokzen commented 8 years ago

Hi. Is there a way to make a bot only respond to direct whispers and make it respond back to the user that sent the message? There are some bots that could use this feature where it would not clog up a channel with alot of messages and output and limit output to only the user that really needs to see the information it would return.

gotlium commented 8 years ago

Hi, you can create your own decorator to do it. For example:

from mattermost_bot.utils import allow_only_direct_message

@respond_to('^selfupdate$')
@allow_only_direct_message()   # allow only direct messages
@admin_access_required()       # your own decorator, to limit users
def self_update(message):
     ...

or you mean anything else?

Grokzen commented 8 years ago

Yes it sounds like something i am looking for.

gotlium commented 8 years ago

Could I close issue?

Grokzen commented 8 years ago

I will play with it tomorrow at work and see how it works.