この前のコミットのバグを今度こそ修正
ついでにメッセージの表示を見やすく
This commit is contained in:
parent
0fcfc8009f
commit
65403a4cca
1 changed files with 38 additions and 6 deletions
44
dislocker.py
44
dislocker.py
|
@ -256,8 +256,11 @@ class Bot(discord.Client):
|
||||||
cursor.execute("SELECT * FROM pc_usage_history WHERE member_id = %s ORDER BY id DESC LIMIT 1", (member_id,))
|
cursor.execute("SELECT * FROM pc_usage_history WHERE member_id = %s ORDER BY id DESC LIMIT 1", (member_id,))
|
||||||
pc_usage_history_record = cursor.fetchall()
|
pc_usage_history_record = cursor.fetchall()
|
||||||
if pc_usage_history_record:
|
if pc_usage_history_record:
|
||||||
if pc_usage_history_record[0][5] == None:
|
if pc_usage_history_record[0][6] == None:
|
||||||
return {"result": 1, "about": "used_by_you", "pc_usage_history": {"pc_number": str(pc_usage_history_record[0][2]), "keyboard_number": str(pc_usage_history_record[0][3]), "mouse_number": str(pc_usage_history_record[0][4]), "start_time": str(pc_usage_history_record[0][5]), "use_detail": str(pc_usage_history_record[0][7])}}
|
keyboard_number = pc_usage_history_record[0][3]
|
||||||
|
mouse_number = pc_usage_history_record[0][4]
|
||||||
|
|
||||||
|
return {"result": 1, "about": "used_by_you", "pc_usage_history": {"pc_number": str(pc_usage_history_record[0][2]), "keyboard_number": keyboard_number, "mouse_number": mouse_number, "start_time": str(pc_usage_history_record[0][5]), "use_detail": str(pc_usage_history_record[0][7])}}
|
||||||
else:
|
else:
|
||||||
return {"result": 0, "about": "vacent"}
|
return {"result": 0, "about": "vacent"}
|
||||||
else:
|
else:
|
||||||
|
@ -268,8 +271,10 @@ class Bot(discord.Client):
|
||||||
cursor.execute("SELECT * FROM pc_usage_history WHERE member_id = %s ORDER BY id DESC LIMIT 1", (member_id,))
|
cursor.execute("SELECT * FROM pc_usage_history WHERE member_id = %s ORDER BY id DESC LIMIT 1", (member_id,))
|
||||||
pc_usage_history_record = cursor.fetchall()
|
pc_usage_history_record = cursor.fetchall()
|
||||||
if pc_usage_history_record:
|
if pc_usage_history_record:
|
||||||
if pc_usage_history_record[0][5] == None:
|
if pc_usage_history_record[0][6] == None:
|
||||||
return {"result": 1, "about": "used_by_you", "pc_usage_history": {"pc_number": str(pc_usage_history_record[0][2]), "keyboard_number": str(pc_usage_history_record[0][3]), "mouse_number": str(pc_usage_history_record[0][4]), "start_time": str(pc_usage_history_record[0][5]), "use_detail": str(pc_usage_history_record[0][7])}}
|
keyboard_number = pc_usage_history_record[0][3]
|
||||||
|
mouse_number = pc_usage_history_record[0][4]
|
||||||
|
return {"result": 1, "about": "used_by_you", "pc_usage_history": {"pc_number": str(pc_usage_history_record[0][2]), "keyboard_number": keyboard_number, "mouse_number": mouse_number, "start_time": str(pc_usage_history_record[0][5]), "use_detail": str(pc_usage_history_record[0][7])}}
|
||||||
else:
|
else:
|
||||||
return {"result": 0, "about": "vacent"}
|
return {"result": 0, "about": "vacent"}
|
||||||
else:
|
else:
|
||||||
|
@ -975,7 +980,20 @@ class Bot(discord.Client):
|
||||||
dislocker.log(title=f"[INFO] PC番号{pc_number} の使用が開始されました。", message=f"名前 | {register["output_dict"]["name"]}, 使用目的 | {reason}", flag=0)
|
dislocker.log(title=f"[INFO] PC番号{pc_number} の使用が開始されました。", message=f"名前 | {register["output_dict"]["name"]}, 使用目的 | {reason}", flag=0)
|
||||||
elif register["about"] == "pc_already_in_use_by_you":
|
elif register["about"] == "pc_already_in_use_by_you":
|
||||||
pc_usage_history = register["pc_usage_history"]
|
pc_usage_history = register["pc_usage_history"]
|
||||||
await interaction.response.send_message(f"# :exploding_head: あなたはPCをもう使用されているようです。\n使用状態を解除するには 終了ボタン で使用終了をお知らせください。\n>>> # PC番号 | {pc_usage_history["pc_number"]}\n# キーボード番号 | {pc_usage_history["keyboard_number"]}\n# マウス番号 | {pc_usage_history["mouse_number"]}\n# 使用開始時刻 | {pc_usage_history["start_time"]}\n# 使用目的 | {pc_usage_history["use_detail"]}", ephemeral=True)
|
if pc_usage_history[keyboard_number] == None:
|
||||||
|
keyboard_number_show = "未認証"
|
||||||
|
elif pc_usage_history[keyboard_number] == 0:
|
||||||
|
keyboard_number_show = "自前"
|
||||||
|
else:
|
||||||
|
keyboard_number_show = str(keyboard_number)
|
||||||
|
|
||||||
|
if pc_usage_history[mouse_number] == None:
|
||||||
|
mouse_number_show = "未認証"
|
||||||
|
elif pc_usage_history[mouse_number] == 0:
|
||||||
|
mouse_number_show = "自前"
|
||||||
|
else:
|
||||||
|
mouse_number_show = str(mouse_number)
|
||||||
|
await interaction.response.send_message(f"# :exploding_head: あなたはPCをもう使用されているようです。\n使用状態を解除するには 終了ボタン で使用終了をお知らせください。\n>>> # PC番号 | {pc_usage_history["pc_number"]}\n# キーボード番号 | {keyboard_number_show}\n# マウス番号 | {mouse_number_show}\n# 使用開始時刻 | {pc_usage_history["start_time"]}\n# 使用目的 | {pc_usage_history["use_detail"]}", ephemeral=True)
|
||||||
elif register["about"] == "pc_already_in_use_by_other":
|
elif register["about"] == "pc_already_in_use_by_other":
|
||||||
await interaction.response.send_message(f"# :man_gesturing_no: そのPCは他のメンバーによって使用されています。\n別のPC番号を指定して、再度お試しください。", ephemeral=True)
|
await interaction.response.send_message(f"# :man_gesturing_no: そのPCは他のメンバーによって使用されています。\n別のPC番号を指定して、再度お試しください。", ephemeral=True)
|
||||||
elif register["about"] == "keyboard_already_in_use":
|
elif register["about"] == "keyboard_already_in_use":
|
||||||
|
@ -1134,7 +1152,21 @@ class Reason(Modal):
|
||||||
dislocker.log(title=f"[INFO] PC番号{pc_number} の使用が開始されました。", message=f"名前 | {register["output_dict"]["name"]}, 使用目的 | {self.reason_input_form.value}", flag=0)
|
dislocker.log(title=f"[INFO] PC番号{pc_number} の使用が開始されました。", message=f"名前 | {register["output_dict"]["name"]}, 使用目的 | {self.reason_input_form.value}", flag=0)
|
||||||
elif register["about"] == "pc_already_in_use_by_you":
|
elif register["about"] == "pc_already_in_use_by_you":
|
||||||
pc_usage_history = register["pc_usage_history"]
|
pc_usage_history = register["pc_usage_history"]
|
||||||
await interaction.response.send_message(f"# :exploding_head: あなたはPCをもう使用されているようです。\n使用状態を解除するには 終了ボタン で使用終了をお知らせください。\n>>> # PC番号 | {pc_usage_history["pc_number"]}\n# キーボード番号 | {pc_usage_history["keyboard_number"]}\n# マウス番号 | {pc_usage_history["mouse_number"]}\n# 使用開始時刻 | {pc_usage_history["start_time"]}\n# 使用目的 | {pc_usage_history["use_detail"]}", ephemeral=True)
|
if pc_usage_history[keyboard_number] == None:
|
||||||
|
keyboard_number_show = "未認証"
|
||||||
|
elif pc_usage_history[keyboard_number] == 0:
|
||||||
|
keyboard_number_show = "自前"
|
||||||
|
else:
|
||||||
|
keyboard_number_show = str(keyboard_number)
|
||||||
|
|
||||||
|
if pc_usage_history[mouse_number] == None:
|
||||||
|
mouse_number_show = "未認証"
|
||||||
|
elif pc_usage_history[mouse_number] == 0:
|
||||||
|
mouse_number_show = "自前"
|
||||||
|
else:
|
||||||
|
mouse_number_show = str(mouse_number)
|
||||||
|
await interaction.response.send_message(f"# :exploding_head: あなたはPCをもう使用されているようです。\n使用状態を解除するには 終了ボタン で使用終了をお知らせください。\n>>> # PC番号 | {pc_usage_history["pc_number"]}\n# キーボード番号 | {keyboard_number_show}\n# マウス番号 | {mouse_number_show}\n# 使用開始時刻 | {pc_usage_history["start_time"]}\n# 使用目的 | {pc_usage_history["use_detail"]}", ephemeral=True)
|
||||||
|
|
||||||
elif register["about"] == "pc_already_in_use_by_other":
|
elif register["about"] == "pc_already_in_use_by_other":
|
||||||
await interaction.response.send_message(f"# :man_gesturing_no: そのPCは他のメンバーによって使用されています。\n別のPC番号を指定して、再度お試しください。", ephemeral=True)
|
await interaction.response.send_message(f"# :man_gesturing_no: そのPCは他のメンバーによって使用されています。\n別のPC番号を指定して、再度お試しください。", ephemeral=True)
|
||||||
elif register["about"] == "keyboard_already_in_use":
|
elif register["about"] == "keyboard_already_in_use":
|
||||||
|
|
Loading…
Reference in a new issue