diff options
Diffstat (limited to 'commands/stats.go')
| -rw-r--r-- | commands/stats.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/commands/stats.go b/commands/stats.go index 017cfc6..fbacb88 100644 --- a/commands/stats.go +++ b/commands/stats.go @@ -53,9 +53,14 @@ func Stats(ctx context.Context, dg bot.Session, i *interaction.ApplicationComman days = 90 } + err := dg.InteractionAPI().Respond(i.Interaction, interaction.NewDeferredResponse()).Do(ctx) + if err != nil { + bot.Logger(ctx).Error("sending deferred", "error", err) + } + resp := interaction.NewMessageResponse() defer func() { - err := dg.InteractionAPI().Respond(i.Interaction, resp.Response()).Do(ctx) + _, err := dg.InteractionAPI().ResponseEdit(i.Interaction, resp.WebhookEdit()).Do(ctx) if err != nil { bot.Logger(ctx).Error("replying to interaction", "error", err) } @@ -71,10 +76,6 @@ func Stats(ctx context.Context, dg bot.Session, i *interaction.ApplicationComman } days = int(in) } - err := dg.InteractionAPI().Respond(i.Interaction, interaction.NewDeferredResponse()).Do(ctx) - if err != nil { - bot.Logger(ctx).Error("sending deferred", "error", err) - } var w io.WriterTo if v, ok := opts["copaing"]; ok { w, err = statsMember(ctx, dg, i, days, v.UserValue(ctx).ID) |
