fix(config): not all interaction were ephemeral
This commit is contained in:
parent
caa3b338a3
commit
7c9d6571fd
3 changed files with 16 additions and 11 deletions
|
@ -75,8 +75,8 @@ func Config(_ *discordgo.Session, i *discordgo.InteractionCreate, _ cmd.OptionMa
|
|||
).
|
||||
AddOption(
|
||||
// I don't have a better idea for this...
|
||||
component.NewSelectOption("Salons de repli", config.ModifyFallbackChannel).
|
||||
SetDescription("Spécifie le salon de repli").
|
||||
component.NewSelectOption("Salons par défaut", config.ModifyFallbackChannel).
|
||||
SetDescription("Spécifie le salon par défaut").
|
||||
SetEmoji(&discordgo.ComponentEmoji{Name: "💾"}),
|
||||
).
|
||||
AddOption(
|
||||
|
|
|
@ -20,7 +20,7 @@ const (
|
|||
)
|
||||
|
||||
func HandleModifyFallbackChannel(_ *discordgo.Session, _ *discordgo.InteractionCreate, _ discordgo.MessageComponentInteractionData, resp *cmd.ResponseBuilder) {
|
||||
err := resp.SetMessage("Salon de repli...").SetComponents(component.New().Add(component.NewActionRow().Add(
|
||||
err := resp.IsEphemeral().SetComponents(component.New().Add(component.NewActionRow().Add(
|
||||
component.NewChannelSelect(FallbackChannelSet).AddChannelType(discordgo.ChannelTypeGuildText),
|
||||
))).Send()
|
||||
if err != nil {
|
||||
|
@ -49,7 +49,7 @@ func HandleFallbackChannelSet(_ *discordgo.Session, i *discordgo.InteractionCrea
|
|||
}
|
||||
|
||||
func HandleModifyDisChannel(_ *discordgo.Session, _ *discordgo.InteractionCreate, _ discordgo.MessageComponentInteractionData, resp *cmd.ResponseBuilder) {
|
||||
err := resp.SetMessage("Salon de repli...").SetComponents(component.New().Add(component.NewActionRow().
|
||||
err := resp.IsEphemeral().SetComponents(component.New().Add(component.NewActionRow().
|
||||
Add(
|
||||
component.NewButton(DisChannelAdd, discordgo.PrimaryButton).
|
||||
SetLabel("Désactiver un salon").
|
||||
|
@ -67,7 +67,7 @@ func HandleModifyDisChannel(_ *discordgo.Session, _ *discordgo.InteractionCreate
|
|||
}
|
||||
|
||||
func HandleDisChannel(_ *discordgo.Session, _ *discordgo.InteractionCreate, data discordgo.MessageComponentInteractionData, resp *cmd.ResponseBuilder) {
|
||||
resp.SetMessage("Salon à désactiver...")
|
||||
resp.IsEphemeral().SetMessage("Salon à désactiver...")
|
||||
cID := DisChannelAddSet
|
||||
if data.CustomID == DisChannelDel {
|
||||
resp.SetMessage("Salon à réactiver...")
|
||||
|
@ -80,6 +80,7 @@ func HandleDisChannel(_ *discordgo.Session, _ *discordgo.InteractionCreate, data
|
|||
}
|
||||
|
||||
func HandleDisChannelAddSet(_ *discordgo.Session, i *discordgo.InteractionCreate, data discordgo.MessageComponentInteractionData, resp *cmd.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
cfg := GetGuildConfig(i.GuildID)
|
||||
id := data.Values[0]
|
||||
if strings.Contains(cfg.DisabledChannels, id) {
|
||||
|
@ -102,6 +103,7 @@ func HandleDisChannelAddSet(_ *discordgo.Session, i *discordgo.InteractionCreate
|
|||
}
|
||||
|
||||
func HandleDisChannelDelSet(_ *discordgo.Session, i *discordgo.InteractionCreate, data discordgo.MessageComponentInteractionData, resp *cmd.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
cfg := GetGuildConfig(i.GuildID)
|
||||
id := data.Values[0]
|
||||
if !strings.Contains(cfg.DisabledChannels, id) {
|
||||
|
|
|
@ -77,6 +77,7 @@ func HandleXpRoleAddEdit(_ *discordgo.Session, _ *discordgo.InteractionCreate, d
|
|||
}
|
||||
|
||||
func HandleXpRoleAddRole(_ *discordgo.Session, i *discordgo.InteractionCreate, data discordgo.MessageComponentInteractionData, resp *cmd.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
cfg := GetGuildConfig(i.GuildID)
|
||||
roleId := data.Values[0]
|
||||
for _, r := range cfg.XpRoles {
|
||||
|
@ -102,12 +103,13 @@ func HandleXpRoleAddRole(_ *discordgo.Session, i *discordgo.InteractionCreate, d
|
|||
"type", "add",
|
||||
)
|
||||
}
|
||||
if err = resp.IsEphemeral().SetMessage("Rôle ajouté.").Send(); err != nil {
|
||||
if err = resp.SetMessage("Rôle ajouté.").Send(); err != nil {
|
||||
logger.Alert("config/xp_role.go - Sending success", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func HandleXpRoleEditRole(_ *discordgo.Session, i *discordgo.InteractionCreate, data discordgo.MessageComponentInteractionData, resp *cmd.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
cfg := GetGuildConfig(i.GuildID)
|
||||
roleId := data.Values[0]
|
||||
_, r := cfg.FindXpRole(roleId)
|
||||
|
@ -129,7 +131,7 @@ func HandleXpRoleEditRole(_ *discordgo.Session, i *discordgo.InteractionCreate,
|
|||
"type", "edit",
|
||||
)
|
||||
}
|
||||
if err = resp.IsEphemeral().SetMessage("Rôle modifié.").Send(); err != nil {
|
||||
if err = resp.SetMessage("Rôle modifié.").Send(); err != nil {
|
||||
logger.Alert("config/xp_role.go - Sending success", err.Error())
|
||||
}
|
||||
}
|
||||
|
@ -145,6 +147,7 @@ func HandleXpRoleDel(_ *discordgo.Session, _ *discordgo.InteractionCreate, _ dis
|
|||
}
|
||||
|
||||
func HandleXpRoleDelRole(_ *discordgo.Session, i *discordgo.InteractionCreate, data discordgo.MessageComponentInteractionData, resp *cmd.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
cfg := GetGuildConfig(i.GuildID)
|
||||
roleId := data.Values[0]
|
||||
_, r := cfg.FindXpRole(roleId)
|
||||
|
@ -165,18 +168,19 @@ func HandleXpRoleDelRole(_ *discordgo.Session, i *discordgo.InteractionCreate, d
|
|||
"type", "del",
|
||||
)
|
||||
}
|
||||
if err = resp.IsEphemeral().SetMessage("Rôle supprimé.").Send(); err != nil {
|
||||
if err = resp.SetMessage("Rôle supprimé.").Send(); err != nil {
|
||||
logger.Alert("config/xp_role.go - Sending success", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func HandleXpRoleLevel(_ *discordgo.Session, i *discordgo.InteractionCreate, data discordgo.ModalSubmitInteractionData, resp *cmd.ResponseBuilder) {
|
||||
resp.IsEphemeral()
|
||||
input := data.Components[0].(*discordgo.ActionsRow).Components[0].(*discordgo.TextInput)
|
||||
|
||||
k := getKeyConfigRole(i)
|
||||
in, err := strconv.Atoi(input.Value)
|
||||
if err != nil || in < 0 {
|
||||
if err = resp.IsEphemeral().
|
||||
if err = resp.
|
||||
SetMessage("Impossible de lire le nombre. Il doit s'agit d'un nombre entier positif.").
|
||||
Send(); err != nil {
|
||||
logger.Alert("command/config.go - Sending bad number", err.Error())
|
||||
|
@ -196,8 +200,7 @@ func HandleXpRoleLevel(_ *discordgo.Session, i *discordgo.InteractionCreate, dat
|
|||
resp.SetMessage("Rôle à modifier")
|
||||
}
|
||||
|
||||
err = resp.IsEphemeral().
|
||||
SetMessage("Rôle à supprimer").
|
||||
err = resp.
|
||||
SetComponents(component.New().Add(component.NewActionRow().Add(component.NewRoleSelect(cID)))).
|
||||
Send()
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue