From a9109dba0a9ae9c08870d1e8421113dc31c9ffd6 Mon Sep 17 00:00:00 2001 From: suti7yk5032 Date: Thu, 25 Jul 2024 23:44:47 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=A0=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E5=87=A6=E7=90=86=E3=81=AE=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dislocker.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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