Skip to content

Commit

Permalink
Merge pull request #391 from EldonMcGuinness/add-trigger.is_privmsg
Browse files Browse the repository at this point in the history
[bot] Added trigger.is_privmsg flag
  • Loading branch information
embolalia committed Dec 14, 2013
2 parents c24a3f8 + 9f31567 commit aa4a13e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions willie/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,12 @@ def __getattr__(self, attr):
class Trigger(unicode):
def __new__(cls, text, origin, bytes, match, event, args, self):
s = unicode.__new__(cls, text)

"""Is trigger from a channel or in PM"""
s.is_privmsg = False
if origin.sender[0] not in '#&+!':
s.is_privmsg = True

s.sender = origin.sender
"""
The channel (or nick, in a private message) from which the
Expand Down

0 comments on commit aa4a13e

Please sign in to comment.