Add Embed with available roles for main dialogue

This commit is contained in:
fanyx 2024-01-23 17:42:10 +01:00
parent 0499339b00
commit dfa2ce0eb0
2 changed files with 12 additions and 3 deletions

13
main.py
View File

@ -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()

View File

@ -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"