pcinfoで登録されていないPCを非表示に

This commit is contained in:
suti7yk5032 2024-10-05 10:30:23 +09:00
parent a8bf3ab4b7
commit 683be42817

View file

@ -1633,18 +1633,21 @@ async def pcinfo(interaction: discord.Interaction):
for i in pc_list['output_dict'].keys():
current_pc_list = pc_list['output_dict'][i]
if current_pc_list['alt_name'] == None:
pc_name_title = f'{current_pc_list['pc_number']}'
if current_pc_list['pc_token'] == None:
pass
else:
pc_name_title = f'{current_pc_list['pc_number']} 番 ({current_pc_list['alt_name']})'
if current_pc_list['alt_name'] == None:
pc_name_title = f'{current_pc_list['pc_number']}'
else:
pc_name_title = f'{current_pc_list['pc_number']} 番 ({current_pc_list['alt_name']})'
if current_pc_list['using_member_id'] == None:
pc_using_value = f'未使用'
else:
discord_user_id = dislocker.get_discord_user_id(member_id=current_pc_list['using_member_id'])['discord_user_id']
pc_using_value = f'<@{discord_user_id}> が使用中'
if current_pc_list['using_member_id'] == None:
pc_using_value = f'未使用'
else:
discord_user_id = dislocker.get_discord_user_id(member_id=current_pc_list['using_member_id'])['discord_user_id']
pc_using_value = f'<@{discord_user_id}> が使用中'
result_embed.add_field(name=f'{pc_name_title}', value=f'{pc_using_value}')
result_embed.add_field(name=f'{pc_name_title}', value=f'{pc_using_value}')
else:
result_embed = discord.Embed(title=":x: 操作に失敗しました。", description=f'サーバーでエラーが発生しています。', color=0xC91111)