message: add possibility to mention bot by name with any characters
This commit is contained in:
parent
15566baf1a
commit
26f49b8eb7
|
@ -58,6 +58,9 @@ class Message(AbstractEntity):
|
|||
"""
|
||||
return random.randint(0, 100) < self.chance
|
||||
|
||||
def is_mentioned(self):
|
||||
return self.text.lower().startswith(config['bot']['mention_name']) or self.text.lower().startswith(config['bot']['mention_name_full'])
|
||||
|
||||
def should_answer(self):
|
||||
"""
|
||||
Returns True if bot should answer to this message
|
||||
|
@ -66,4 +69,4 @@ class Message(AbstractEntity):
|
|||
return self.has_anchors() \
|
||||
or self.is_private() \
|
||||
or self.is_reply_to_bot() \
|
||||
or self.is_random_answer()
|
||||
or self.is_random_answer() or self.is_mentioned()
|
||||
|
|
Loading…
Reference in New Issue