delay sub response to give more time if bot is running with a bad connection
This commit is contained in:
parent
488d08179b
commit
18d2ebcd23
17
main.go
17
main.go
@ -96,17 +96,14 @@ func init() {
|
||||
|
||||
func send_error(s *dg.Session, i *dg.Interaction, reason string) {
|
||||
log.Printf("Sending error (\"%s\")", reason)
|
||||
s.InteractionRespond(i, &dg.InteractionResponse{
|
||||
Type: dg.InteractionResponseChannelMessageWithSource,
|
||||
Data: &dg.InteractionResponseData{
|
||||
Embeds: []*dg.MessageEmbed{
|
||||
s.InteractionResponseEdit(i, &dg.WebhookEdit{
|
||||
Embeds: &[]*dg.MessageEmbed{
|
||||
{
|
||||
Title: "⚠️ Error",
|
||||
Description: reason,
|
||||
Color: 0xFF0000,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@ -121,6 +118,9 @@ var handlers = map[string]func(*dg.Session, *dg.InteractionCreate){
|
||||
})
|
||||
},
|
||||
"sub": func(s *dg.Session, i *dg.InteractionCreate) {
|
||||
s.InteractionRespond(i.Interaction, &dg.InteractionResponse{
|
||||
Type: dg.InteractionResponseDeferredChannelMessageWithSource,
|
||||
})
|
||||
red := 0
|
||||
green := 0
|
||||
guesses := []string{}
|
||||
@ -182,17 +182,14 @@ var handlers = map[string]func(*dg.Session, *dg.InteractionCreate){
|
||||
} else {
|
||||
title = "Guess by " + cmdAuthor
|
||||
}
|
||||
s.InteractionRespond(i.Interaction, &dg.InteractionResponse{
|
||||
Type: dg.InteractionResponseChannelMessageWithSource,
|
||||
Data: &dg.InteractionResponseData{
|
||||
Embeds: []*dg.MessageEmbed{
|
||||
s.InteractionResponseEdit(i.Interaction, &dg.WebhookEdit{
|
||||
Embeds: &[]*dg.MessageEmbed{
|
||||
{
|
||||
Title: title,
|
||||
Description: strings.Join(guesses, "\n") + "\n\n**" + strconv.Itoa(green) + " 🟩**\n**" + strconv.Itoa(red) + " 🟥**",
|
||||
Color: stg.Color,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
if green == len(stg.students) {
|
||||
var winTitle string
|
||||
|
||||
Loading…
Reference in New Issue
Block a user