custom_idで言うところのreasonregisterあたりの処理を修正

This commit is contained in:
suti7yk5032 2024-08-23 00:53:03 +09:00
parent 7d7cc17193
commit 9269441051

View file

@ -850,8 +850,9 @@ class Bot(discord.Client):
elif custom_id_split[0] == "reasonregister": elif custom_id_split[0] == "reasonregister":
pc_number = custom_id_split[1] pc_number = custom_id_split[1]
device_number = custom_id_split[2] keyboard_number = custom_id_split[2]
reason_input_form = Reason(title="Dislocker | 登録", pc_number=str(pc_number), device_number=str(device_number)) mouse_number = custom_id_split[3]
reason_input_form = Reason(title="Dislocker | 登録", pc_number=str(pc_number), keyboard_number=str(keyboard_number), mouse_number=str(mouse_number))
await interaction.response.send_modal(reason_input_form) await interaction.response.send_modal(reason_input_form)
elif custom_id_split[0] == "stop": elif custom_id_split[0] == "stop":
@ -979,11 +980,10 @@ class Monitor():
class Reason(Modal): class Reason(Modal):
def __init__(self, title: str, pc_number: str, device_number: str, timeout=15) -> None: def __init__(self, title: str, pc_number: str, keyboard_number: str, mouse_number: str, timeout=15) -> None:
super().__init__(title=title, timeout=timeout) super().__init__(title=title, timeout=timeout)
print(pc_number) print(pc_number, keyboard_number, mouse_number)
print(device_number) self.reason_input_form = TextInput(label="使用目的を入力してください", style=TextStyle.short, custom_id=f"register_{pc_number}_{keyboard_number}_{mouse_number}")
self.reason_input_form = TextInput(label="使用目的を入力してください", style=TextStyle.short, custom_id=f"register_{pc_number}_{device_number}")
self.add_item(self.reason_input_form) self.add_item(self.reason_input_form)
async def on_submit(self, interaction: Interaction) -> None: async def on_submit(self, interaction: Interaction) -> None: