Browse Source

Meilleure gestion des usernames

merge-requests/1/head
Klafyvel 8 years ago
parent
commit
53310ede4e
  1. 4
      klafirc/bot.py

4
klafirc/bot.py

@ -14,6 +14,7 @@ class Bot:
self.server = None
self.reactions = {}
self.pings = []
self.tg_user_match = re.compile('^<(?P<username>.+)>')
self.ping_match = re.compile('^(<.+> )?\@?{name}'.format(name=nickname))
def add_reaction(self, match, reaction):
@ -47,6 +48,9 @@ class Bot:
Every matched reactions.
"""
username = user.split('!')[0]
tg_user_match = self.tg_user_match.match(message)
if 'bot' in username.lower() and tg_user_match:
username = '@' + tg_user_match.groupdict()
context = {
'server': self.server,

Loading…
Cancel
Save