|
|
@ -19,7 +19,7 @@ class Bot: |
|
|
self.on_join = None |
|
|
self.on_join = None |
|
|
self.tg_user_match = re.compile('^<\x03..\x02\x02(?P<username>.+)\x03>') |
|
|
self.tg_user_match = re.compile('^<\x03..\x02\x02(?P<username>.+)\x03>') |
|
|
self.ping_match = re.compile('^(<.+> )?\@?{name}'.format(name=nickname)) |
|
|
self.ping_match = re.compile('^(<.+> )?\@?{name}'.format(name=nickname)) |
|
|
self.min_time = 30 |
|
|
self.min_time = 0 |
|
|
self.last_time = datetime.datetime(1,1,1) |
|
|
self.last_time = datetime.datetime(1,1,1) |
|
|
|
|
|
|
|
|
def add_reaction(self, match, reaction): |
|
|
def add_reaction(self, match, reaction): |
|
|
@ -73,7 +73,7 @@ class Bot: |
|
|
""" |
|
|
""" |
|
|
if (datetime.datetime.now() - self.last_time).total_seconds() < self.min_time: |
|
|
if (datetime.datetime.now() - self.last_time).total_seconds() < self.min_time: |
|
|
return [] |
|
|
return [] |
|
|
username = username.split('!')[0] |
|
|
username = user.split('!')[0] |
|
|
tg_user_match = self.tg_user_match.match(message) |
|
|
tg_user_match = self.tg_user_match.match(message) |
|
|
if 'bot' in username.lower() and tg_user_match: |
|
|
if 'bot' in username.lower() and tg_user_match: |
|
|
username = '@' + tg_user_match.groupdict()['username'] |
|
|
username = '@' + tg_user_match.groupdict()['username'] |
|
|
|