refactor(config): use button to select action for xp role

This commit is contained in:
Anhgelus Morhtuuzh 2025-08-06 15:19:31 +02:00
parent 6d19ef42c4
commit 51a412b32d
Signed by: anhgelus
GPG key ID: 617773CACE89052C

View file

@ -37,24 +37,20 @@ var (
func HandleModifyXpRole(_ *discordgo.Session, _ *discordgo.InteractionCreate, _ discordgo.MessageComponentInteractionData, resp *cmd.ResponseBuilder) {
err := resp.IsEphemeral().
SetMessage("Action à réaliser").
SetComponents(component.New().Add(component.NewActionRow().Add(
component.NewStringSelect(ModifyXpRole).SetPlaceholder("Action").
AddOption(
component.NewSelectOption("Ajouter", XpRoleAdd).
SetDescription("Ajouter un rôle à XP").
SetComponents(component.New().Add(component.NewActionRow().
Add(component.NewButton(XpRoleAdd, discordgo.PrimaryButton).
SetLabel("Ajouter").
SetEmoji(&discordgo.ComponentEmoji{Name: "⬆️"}),
).
AddOption(
component.NewSelectOption("Modifier", XpRoleEdit).
SetDescription("Modifier un rôle à XP").
Add(component.NewButton(XpRoleEdit, discordgo.SecondaryButton).
SetLabel("Modifier").
SetEmoji(&discordgo.ComponentEmoji{Name: "📝"}),
).
AddOption(
component.NewSelectOption("Supprimer", XpRoleDel).
SetDescription("Supprimer un rôle à XP").
Add(component.NewButton(XpRoleDel, discordgo.DangerButton).
SetLabel("Supprimer").
SetEmoji(&discordgo.ComponentEmoji{Name: "❌"}),
),
))).Send()
)).Send()
if err != nil {
logger.Alert("config/guild.go - Sending config", err.Error())
}