fix reaction validate

This commit is contained in:
2026-02-18 18:27:12 +01:00
parent 0e2b4a4497
commit 2a7708d608
+4 -4
View File
@@ -8,7 +8,7 @@ logging.basicConfig(format='[%(asctime)s] %(process)s {%(filename)s:%(lineno)d}
class BotHelper: class BotHelper:
"""a helper class for frequently need actions""" """a helper class for frequently need actions"""
__AUTHOR__ = 'anima' __AUTHOR__ = 'anima'
__VERSION__ = '0.3.1' __VERSION__ = '0.3.2'
def __init__(self, client): def __init__(self, client):
self.client = client self.client = client
self.starttime = int(time.time() * 1000) self.starttime = int(time.time() * 1000)
@@ -28,15 +28,15 @@ class BotHelper:
def validate_reaction(self, event: ReactionEvent): def validate_reaction(self, event: ReactionEvent):
"""validate incomming reactions befor bot start his work""" """validate incomming reactions befor bot start his work"""
if isinstance(event, ReactionEvent): if not isinstance(event, ReactionEvent):
print(event)
print(type(event))
logging.debug(f"reaction hast wrong type") logging.debug(f"reaction hast wrong type")
return False return False
if self.client.user == event.sender: if self.client.user == event.sender:
logging.debug(f"no reaction on reactions from bot it self") logging.debug(f"no reaction on reactions from bot it self")
return False return False
if self.starttime > event.server_timestamp: if self.starttime > event.server_timestamp:
print(f"{self.starttime=}")
print(f"{event.server_timestamp=}")
logging.debug(f"no reaction on reactions befor bot start") logging.debug(f"no reaction on reactions befor bot start")
return False return False
return True return True