fix: edit type deferReply argument
This commit is contained in:
parent
0fdfd1cbd7
commit
218c019989
5 changed files with 20 additions and 15 deletions
|
@ -47,7 +47,9 @@ var DataLengthCommand *Command = &Command{
|
|||
dataLengthRun(ctx.Msg, ctx.Msg.Author.Username, ctx.Msg.Author.ID)
|
||||
},
|
||||
ChatInputRun: func(ctx *ChatInputContext) {
|
||||
ctx.Inter.DeferReply(true)
|
||||
ctx.Inter.DeferReply(&discordgo.InteractionResponseData{
|
||||
Flags: discordgo.MessageFlagsEphemeral,
|
||||
})
|
||||
dataLengthRun(ctx.Inter, ctx.Inter.Member.User.Username, ctx.Inter.Member.User.ID)
|
||||
},
|
||||
}
|
||||
|
|
|
@ -55,7 +55,9 @@ var DeleteLearnedDataCommand *Command = &Command{
|
|||
deleteLearnedDataRun(ctx.Msg, strings.Join(*ctx.Args, " "), ctx.Msg.Author.ID)
|
||||
},
|
||||
ChatInputRun: func(ctx *ChatInputContext) {
|
||||
ctx.Inter.DeferReply(true)
|
||||
ctx.Inter.DeferReply(&discordgo.InteractionResponseData{
|
||||
Flags: discordgo.MessageFlagsEphemeral,
|
||||
})
|
||||
|
||||
var command string
|
||||
|
||||
|
|
|
@ -89,7 +89,9 @@ var LearnCommand *Command = &Command{
|
|||
learnRun(ctx.Msg, ctx.Msg.Author.ID, strings.ReplaceAll((*ctx.Args)[0], "_", " "), strings.ReplaceAll((*ctx.Args)[1], "_", " "))
|
||||
},
|
||||
ChatInputRun: func(ctx *ChatInputContext) {
|
||||
ctx.Inter.DeferReply(true)
|
||||
ctx.Inter.DeferReply(&discordgo.InteractionResponseData{
|
||||
Flags: discordgo.MessageFlagsEphemeral,
|
||||
})
|
||||
|
||||
var command, result string
|
||||
|
||||
|
|
|
@ -124,7 +124,9 @@ var LearnedDataListCommand *Command = &Command{
|
|||
learnedDataListRun(ctx.Msg.Session, ctx.Msg, ctx.Msg.Author.GlobalName, ctx.Msg.Author.AvatarURL("512"), filter, length)
|
||||
},
|
||||
ChatInputRun: func(ctx *ChatInputContext) {
|
||||
ctx.Inter.DeferReply(true)
|
||||
ctx.Inter.DeferReply(&discordgo.InteractionResponseData{
|
||||
Flags: discordgo.MessageFlagsEphemeral,
|
||||
})
|
||||
|
||||
var length int
|
||||
|
||||
|
|
|
@ -56,20 +56,17 @@ func GetInteractionOptions(i *discordgo.InteractionCreate) map[string]*discordgo
|
|||
}
|
||||
|
||||
// DeferReply to this interaction.
|
||||
func (i *InteractionCreate) DeferReply(ephemeral bool) {
|
||||
var flags discordgo.MessageFlags
|
||||
if ephemeral {
|
||||
flags = discordgo.MessageFlagsEphemeral
|
||||
func (i *InteractionCreate) DeferReply(data *discordgo.InteractionResponseData) error {
|
||||
err := i.Session.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseDeferredChannelMessageWithSource,
|
||||
Data: data,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
i.Session.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseDeferredChannelMessageWithSource,
|
||||
Data: &discordgo.InteractionResponseData{
|
||||
Flags: flags,
|
||||
},
|
||||
})
|
||||
|
||||
i.Deferred = true
|
||||
return err
|
||||
}
|
||||
|
||||
// DeferUpdate to this interaction.
|
||||
|
|
Loading…
Reference in a new issue