Add Embed with available roles for main dialogue
This commit is contained in:
parent
0499339b00
commit
dfa2ce0eb0
13
main.py
13
main.py
|
@ -6,7 +6,7 @@ from yaml import safe_load
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord.ext.commands import Greedy, Context
|
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.roles import AddRoleButton, RemoveRoleButton
|
||||||
from src.ui import RoleSelectView
|
from src.ui import RoleSelectView
|
||||||
|
@ -33,7 +33,16 @@ roles = app_commands.Group(name="roles", description="Manage role dialogues")
|
||||||
## Group: roles
|
## Group: roles
|
||||||
@roles.command(name="create")
|
@roles.command(name="create")
|
||||||
async def roles_create_button(interaction: discord.Interaction):
|
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 ~
|
# Sync using ,sync ~
|
||||||
@client.command()
|
@client.command()
|
||||||
|
|
|
@ -9,7 +9,7 @@ class RoleSelectView(View):
|
||||||
super().__init__(timeout=None)
|
super().__init__(timeout=None)
|
||||||
self.add_item(
|
self.add_item(
|
||||||
AddRoleButton(
|
AddRoleButton(
|
||||||
style=ButtonStyle.primary,
|
style=ButtonStyle.secondary,
|
||||||
label="Add Roles",
|
label="Add Roles",
|
||||||
emoji=PartialEmoji.from_str(emojize(":check_mark_button:")),
|
emoji=PartialEmoji.from_str(emojize(":check_mark_button:")),
|
||||||
custom_id="role_select:add"
|
custom_id="role_select:add"
|
||||||
|
|
Loading…
Reference in New Issue