update sub title according to locale

This commit is contained in:
Arkitu 2026-01-19 10:38:13 +01:00
parent b9d8f9e197
commit 2fa3be3a8b

10
main.go
View File

@ -56,7 +56,7 @@ var descs = map[string]*dg.ApplicationCommand{
}, },
// /!\ Make sure to update handler if other options are added // /!\ Make sure to update handler if other options are added
// Guess options are added in init function // Guess options are added in init function
// It's assumed in handler that there aren't other options // It is assumed in handler that there aren't other options
Options: []*dg.ApplicationCommandOption{}, Options: []*dg.ApplicationCommandOption{},
}, },
} }
@ -157,12 +157,18 @@ var handlers = map[string]func(*dg.Session, *dg.InteractionCreate){
} else { } else {
cmdAuthor = i.User.DisplayName() cmdAuthor = i.User.DisplayName()
} }
var title string
if i.Locale == dg.French {
title = "Tentative par " + cmdAuthor
} else {
title = "Guess by " + cmdAuthor
}
s.InteractionRespond(i.Interaction, &dg.InteractionResponse{ s.InteractionRespond(i.Interaction, &dg.InteractionResponse{
Type: dg.InteractionResponseChannelMessageWithSource, Type: dg.InteractionResponseChannelMessageWithSource,
Data: &dg.InteractionResponseData{ Data: &dg.InteractionResponseData{
Embeds: []*dg.MessageEmbed{ Embeds: []*dg.MessageEmbed{
{ {
Title: "Guess by " + cmdAuthor, Title: title,
Description: strings.Join(guesses, "\n") + "\n\n**" + strconv.Itoa(green) + " 🟩**\n**" + strconv.Itoa(red) + " 🟥**", Description: strings.Join(guesses, "\n") + "\n\n**" + strconv.Itoa(green) + " 🟩**\n**" + strconv.Itoa(red) + " 🟥**",
Color: stg.Color, Color: stg.Color,
}, },