登録されていないPCのボタンは送信しないように
This commit is contained in:
parent
461bcf6fba
commit
bc35550693
1 changed files with 7 additions and 3 deletions
10
dislocker.py
10
dislocker.py
|
@ -1587,10 +1587,14 @@ async def button_init(interaction: discord.Interaction, text_channel: discord.Te
|
|||
pc_button_view = discord.ui.View(timeout=None)
|
||||
for i in pc_list["output_dict"].keys():
|
||||
current_pc_list = pc_list['output_dict'][i]
|
||||
if current_pc_list['alt_name'] == None:
|
||||
pc_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label=f"{str(current_pc_list['pc_number'])} 番", custom_id=f"pcregister_{str(current_pc_list['pc_number'])}")
|
||||
if current_pc_list['pc_token'] == None:
|
||||
pass
|
||||
else:
|
||||
pc_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label=f"{str(current_pc_list['pc_number'])} 番 | ({current_pc_list['alt_name']})", custom_id=f"pcregister_{str(current_pc_list['pc_number'])}")
|
||||
if current_pc_list['alt_name'] == None:
|
||||
pc_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label=f"{str(current_pc_list['pc_number'])} 番", custom_id=f"pcregister_{str(current_pc_list['pc_number'])}")
|
||||
else:
|
||||
pc_register_button = discord.ui.Button(style=discord.ButtonStyle.primary, label=f"{str(current_pc_list['pc_number'])} 番 | ({current_pc_list['alt_name']})", custom_id=f"pcregister_{str(current_pc_list['pc_number'])}")
|
||||
|
||||
pc_button_view.add_item(pc_register_button)
|
||||
|
||||
await client.get_channel(text_channel.id).send(f'# :index_pointing_at_the_viewer: 使いたいPCの番号を選んでください!', view=pc_button_view)
|
||||
|
|
Loading…
Reference in a new issue