bot: add most_specific_msg for convenience

returns original_msg or addressed_msg, depending on the context

related to bss/dr.botzo#32
This commit is contained in:
Brian S. Stephan 2017-03-10 18:16:35 -06:00
parent a79d0cdd9f
commit 1e428b77db

View File

@ -79,3 +79,14 @@ def reply_destination_for_event(event):
return event.target
else:
return irc.client.NickMask(event.source).nick
def most_specific_message(event):
"""Provides the "most specific" message for a pubmsg/privmsg.
Specificity is defined as the raw message, or the message after a "bot: blah" address.
"""
if event.addressed:
return event.addressed_msg
else:
return event.original_msg