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