diff --git a/dislocker.py b/dislocker.py index 10b64b3..fd77173 100644 --- a/dislocker.py +++ b/dislocker.py @@ -649,13 +649,17 @@ class Monitor(): print(type(start_time)) current_time = datetime.now() time_difference = current_time - start_time - if time_difference >= timedelta(seconds=self.allowable_time): + print(current_time, start_time) + print(time_difference.seconds, timedelta(seconds=self.allowable_time).seconds) + if time_difference.seconds >= timedelta(seconds=self.allowable_time).seconds: cursor.execute("SELECT * FROM club_member WHERE id = %s", (user_id,)) user_info = cursor.fetchall() stop = bot.stop(user_id=user_info[0][3]) bot.timeout_notify(pc_number=pc_list[0][0], discord_display_name=user_info[0][1]) time.sleep(1) + else: + result = {"result": "BUT SAFE"} elif len(pc_list) >= 2: @@ -670,13 +674,16 @@ class Monitor(): print(type(start_time)) current_time = datetime.now() time_difference = current_time - start_time - if time_difference >= timedelta(seconds=self.allowable_time): + print(time_difference.seconds, timedelta(seconds=self.allowable_time).seconds) + if time_difference.seconds >= timedelta(seconds=self.allowable_time).seconds: cursor.execute("SELECT * FROM club_member WHERE id = %s", (user_id,)) user_info = cursor.fetchall() stop = bot.stop(user_id=user_info[0][3]) bot.timeout_notify(pc_number=i[0], discord_display_name=user_info[0][1]) time.sleep(0.1) + else: + result = {"result": "BUT SAFE"} else: result = {"result": "NONE"} @@ -740,8 +747,8 @@ if dislocker.init_result == "ok": intents = discord.Intents.default() intents.message_content = True bot = Bot(intents=intents) - #monitor = Monitor() - #monitor.start(search_time=10, allowable_time=300) + monitor = Monitor() + monitor.start(search_time=10, allowable_time=300) bot.run(dislocker.server_config['bot']['token']) else: pass \ No newline at end of file