From dfa2ce0eb0e4ccc84ea72e974710ba78a1b25c18 Mon Sep 17 00:00:00 2001 From: fanyx Date: Tue, 23 Jan 2024 17:42:10 +0100 Subject: [PATCH] Add Embed with available roles for main dialogue --- main.py | 13 +++++++++++-- src/ui.py | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index a9fafb7..6589230 100755 --- a/main.py +++ b/main.py @@ -6,7 +6,7 @@ from yaml import safe_load import discord from discord.ext import commands from discord.ext.commands import Greedy, Context -from discord import app_commands +from discord import app_commands, Embed from src.roles import AddRoleButton, RemoveRoleButton from src.ui import RoleSelectView @@ -33,7 +33,16 @@ roles = app_commands.Group(name="roles", description="Manage role dialogues") ## Group: roles @roles.command(name="create") async def roles_create_button(interaction: discord.Interaction): - await interaction.response.send_message(view=RoleSelectView()) + await interaction.response.send_message( + view=RoleSelectView(), + embed=Embed( + title="Available Roles:", + description="\n".join([ + f"{interaction.client.get_emoji(role['emoji'])} {interaction.guild.get_role(role['id']).mention}" + for role in interaction.client.config['roles'] + ]) + ) + ) # Sync using ,sync ~ @client.command() diff --git a/src/ui.py b/src/ui.py index e667927..8dbd32b 100644 --- a/src/ui.py +++ b/src/ui.py @@ -9,7 +9,7 @@ class RoleSelectView(View): super().__init__(timeout=None) self.add_item( AddRoleButton( - style=ButtonStyle.primary, + style=ButtonStyle.secondary, label="Add Roles", emoji=PartialEmoji.from_str(emojize(":check_mark_button:")), custom_id="role_select:add"