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