使用理由のモーダルが起動しなかったバグを修正

This commit is contained in:
suti7yk5032 2024-09-26 16:57:49 +09:00
parent fc16d15ef9
commit 65d1f6e568

View file

@ -705,7 +705,7 @@ class DL():
class ReasonModal(discord.ui.Modal): class ReasonModal(discord.ui.Modal):
def __init__(self, title: str, pc_number: str, keyboard_number: str, mouse_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)
self.reason_input_form = discord.ui.TextInput(label="使用目的を入力してください", style=discord.ui.TextInput.short, custom_id=f"register_{pc_number}_{keyboard_number}_{mouse_number}") self.reason_input_form = discord.ui.TextInput(label="使用目的を入力してください", style=discord.TextStyle.short, custom_id=f"register_{pc_number}_{keyboard_number}_{mouse_number}")
self.add_item(self.reason_input_form) self.add_item(self.reason_input_form)
async def on_submit(self, interaction: discord.Interaction) -> None: async def on_submit(self, interaction: discord.Interaction) -> None:
@ -795,8 +795,11 @@ async def on_button(interaction: discord.Interaction):
keyboard_register_view = discord.ui.View(timeout=15) keyboard_register_view = discord.ui.View(timeout=15)
pc_number = custom_id_split[1] pc_number = custom_id_split[1]
for i in dislocker.keyboard_list: for i in dislocker.keyboard_list:
keyboard_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label=f"{str(i)}", custom_id=f"keyboardregister_{str(pc_number)}_{str(i)}") if i == 0:
keyboard_register_view.add_item(keyboard_register_button) pass
else:
keyboard_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label=f"{str(i)}", custom_id=f"keyboardregister_{str(pc_number)}_{str(i)}")
keyboard_register_view.add_item(keyboard_register_button)
keyboard_not_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label="キーボードは自前", custom_id=f"keyboardregister_{str(pc_number)}_own") keyboard_not_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label="キーボードは自前", custom_id=f"keyboardregister_{str(pc_number)}_own")
keyboard_register_view.add_item(keyboard_not_register_button) keyboard_register_view.add_item(keyboard_not_register_button)
@ -811,8 +814,11 @@ async def on_button(interaction: discord.Interaction):
else: else:
keyboard_number_show = keyboard_number keyboard_number_show = keyboard_number
for i in dislocker.mouse_list: for i in dislocker.mouse_list:
mouse_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label=f"{str(i)}", custom_id=f"mouseregister_{str(pc_number)}_{str(keyboard_number)}_{str(i)}") if i == 0:
mouse_register_view.add_item(mouse_register_button) pass
else:
mouse_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label=f"{str(i)}", custom_id=f"mouseregister_{str(pc_number)}_{str(keyboard_number)}_{str(i)}")
mouse_register_view.add_item(mouse_register_button)
mouse_not_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label="マウスは自前", custom_id=f"mouseregister_{str(pc_number)}_{str(keyboard_number)}_own") mouse_not_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label="マウスは自前", custom_id=f"mouseregister_{str(pc_number)}_{str(keyboard_number)}_own")
mouse_register_view.add_item(mouse_not_register_button) mouse_register_view.add_item(mouse_not_register_button)