feat: enable/disable notifications of internal/barbarian conquers
All checks were successful
continuous-integration/drone/pr Build is passing

This commit is contained in:
Dawid Wysokiński 2022-10-28 13:57:11 +02:00
parent 02141fb6e8
commit 4f1f332ddb
Signed by: Kichiyaki
GPG Key ID: B5445E357FB8B892
2 changed files with 11 additions and 2 deletions

View File

@ -624,7 +624,7 @@ func (c *groupCommand) handleDelete(s *discordgo.Session, i *discordgo.Interacti
} }
func buildGroupListDescription(groups []domain.Group) string { func buildGroupListDescription(groups []domain.Group) string {
description := "**ID** - **Server** - **Channel gains** - **Channel losses**" description := "**ID** - **Server** - **Channel gains** - **Channel losses** - **Internals** - **Barbarians**"
for i, g := range groups { for i, g := range groups {
channelGains := "Not set" channelGains := "Not set"
if g.ChannelGains != "" { if g.ChannelGains != "" {
@ -635,12 +635,14 @@ func buildGroupListDescription(groups []domain.Group) string {
channelLosses = "<#" + g.ChannelLosses + ">" channelLosses = "<#" + g.ChannelLosses + ">"
} }
description += fmt.Sprintf( description += fmt.Sprintf(
"\n%d. %s - %s - %s - %s", "\n%d. %s - %s - %s - %s - %s - %s",
i+1, i+1,
g.ID, g.ID,
g.ServerKey, g.ServerKey,
channelGains, channelGains,
channelLosses, channelLosses,
boolToEmoji(g.Internals),
boolToEmoji(g.Barbarians),
) )
} }
return description return description

View File

@ -30,3 +30,10 @@ func buildLink(text string, url string) string {
} }
return fmt.Sprintf("[`%s`](%s)", text, url) return fmt.Sprintf("[`%s`](%s)", text, url)
} }
func boolToEmoji(val bool) string {
if val {
return ":white_check_mark:"
}
return ":x:"
}