bump github.com/tribalwarshelp/shared and github.com/tribalwarshelp/golang-sdk, fix panic caused by nil lang version pointer

This commit is contained in:
Dawid Wysokiński 2020-07-21 11:51:58 +02:00 committed by Kichiyaki
parent 5ad56f71bf
commit 860499461e
6 changed files with 16 additions and 14 deletions

View File

@ -148,6 +148,7 @@ func (h *handler) checkEnnoblements() {
(!group.ShowEnnobledBarbarians && isBarbarian) { (!group.ShowEnnobledBarbarians && isBarbarian) {
continue continue
} }
newMsgDataConfig := newMessageConfig{ newMsgDataConfig := newMessageConfig{
host: langVersion.Host, host: langVersion.Host,
server: observation.Server, server: observation.Server,
@ -175,6 +176,7 @@ func (h *handler) checkEnnoblements() {
SetTimestamp(formatDateOfConquest(time.Now())). SetTimestamp(formatDateOfConquest(time.Now())).
MessageEmbed) MessageEmbed)
} }
if group.LostVillagesChannelID != "" && !lostVillagesMsg.IsEmpty() { if group.LostVillagesChannelID != "" && !lostVillagesMsg.IsEmpty() {
h.discord.SendEmbed(group.LostVillagesChannelID, h.discord.SendEmbed(group.LostVillagesChannelID,
discord. discord.

View File

@ -185,7 +185,7 @@ func (s *Session) handleConqueredVillagesCommand(ctx commandCtx, m *discordgo.Me
m.Author.Mention()+" "+ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ m.Author.Mention()+" "+ctx.localizer.MustLocalize(&i18n.LocalizeConfig{
MessageID: "help.conqueredvillages", MessageID: "help.conqueredvillages",
DefaultMessage: message.FallbackMsg("help.conqueredvillages", DefaultMessage: message.FallbackMsg("help.conqueredvillages",
"**{{.Command}}** [group id from {{.GroupsCommand}}] - changes the channel on which notifications about conquered village will show. **IMPORTANT!** Call this command on the channel you want to display these notifications."), "**{{.Command}}** [group id from {{.GroupsCommand}}] - changes the channel on which notifications about conquered village will show. **IMPORTANT!** Run this command on the channel you want to display these notifications."),
TemplateData: map[string]interface{}{ TemplateData: map[string]interface{}{
"Command": ConqueredVillagesCommand.WithPrefix(s.cfg.CommandPrefix), "Command": ConqueredVillagesCommand.WithPrefix(s.cfg.CommandPrefix),
"GroupsCommand": GroupsCommand.WithPrefix(s.cfg.CommandPrefix), "GroupsCommand": GroupsCommand.WithPrefix(s.cfg.CommandPrefix),
@ -321,7 +321,7 @@ func (s *Session) handleLostVillagesCommand(ctx commandCtx, m *discordgo.Message
m.Author.Mention()+" "+ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ m.Author.Mention()+" "+ctx.localizer.MustLocalize(&i18n.LocalizeConfig{
MessageID: "help.lostvillages", MessageID: "help.lostvillages",
DefaultMessage: message.FallbackMsg("help.lostvillages", DefaultMessage: message.FallbackMsg("help.lostvillages",
"**{{.Command}}** [group id from {{.GroupsCommand}}] changes the channel on which notifications about lost village will show. **IMPORTANT!** Call this command on the channel you want to display these notifications."), "**{{.Command}}** [group id from {{.GroupsCommand}}] changes the channel on which notifications about lost village will show. **IMPORTANT!** Run this command on the channel you want to display these notifications."),
TemplateData: map[string]interface{}{ TemplateData: map[string]interface{}{
"Command": LostVillagesCommand.WithPrefix(s.cfg.CommandPrefix), "Command": LostVillagesCommand.WithPrefix(s.cfg.CommandPrefix),
"GroupsCommand": GroupsCommand.WithPrefix(s.cfg.CommandPrefix), "GroupsCommand": GroupsCommand.WithPrefix(s.cfg.CommandPrefix),
@ -778,8 +778,8 @@ func (s *Session) handleObservationsCommand(ctx commandCtx, m *discordgo.Message
}) })
msg := &EmbedMessage{} msg := &EmbedMessage{}
if len(observations) <= 0 { if len(observations) <= 0 || err != nil || langVersionList != nil {
msg.Append("Brak") msg.Append("-")
} else { } else {
for i, observation := range observations { for i, observation := range observations {
tag := "Unknown" tag := "Unknown"

View File

@ -439,7 +439,7 @@ func (s *Session) handleTribeCommand(ctx commandCtx, m *discordgo.MessageCreate,
SetFields(msg.ToMessageEmbedFields()). SetFields(msg.ToMessageEmbedFields()).
SetFooter(ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ SetFooter(ctx.localizer.MustLocalize(&i18n.LocalizeConfig{
MessageID: "pagination.labelDisplayedPage", MessageID: "pagination.labelDisplayedPage",
DefaultMessage: message.FallbackMsg("pagination.labelDisplayedPage", "{{.Page}} from {{.MaxPage}}"), DefaultMessage: message.FallbackMsg("pagination.labelDisplayedPage", "{{.Page}} of {{.MaxPage}}"),
TemplateData: map[string]interface{}{ TemplateData: map[string]interface{}{
"Page": page, "Page": page,
"MaxPage": totalPages, "MaxPage": totalPages,

4
go.mod
View File

@ -10,8 +10,8 @@ require (
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
github.com/segmentio/encoding v0.1.14 // indirect github.com/segmentio/encoding v0.1.14 // indirect
github.com/tribalwarshelp/golang-sdk v0.0.0-20200709112050-ba3a7ba145b1 github.com/tribalwarshelp/golang-sdk v0.0.0-20200721095058-9ee3513a54a9
github.com/tribalwarshelp/shared v0.0.0-20200707075151-722e4a520a3c github.com/tribalwarshelp/shared v0.0.0-20200721094728-9ea33a732990
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 // indirect golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 // indirect
golang.org/x/text v0.3.2 golang.org/x/text v0.3.2
) )

8
go.sum
View File

@ -105,10 +105,10 @@ github.com/stretchr/testify v1.6.0 h1:jlIyCplCJFULU/01vCkhKuTyc3OorI3bJFuw6obfgh
github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo=
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs=
github.com/tribalwarshelp/golang-sdk v0.0.0-20200709112050-ba3a7ba145b1 h1:p+/OHcQQYXCmxjG+YTkXfeL4Oxku7t6sW0KK2Ne85V4= github.com/tribalwarshelp/golang-sdk v0.0.0-20200721095058-9ee3513a54a9 h1:y4fY0Ax8/OUMWvRFr9FkZ9QrKSi4MKsbovt31J3N+us=
github.com/tribalwarshelp/golang-sdk v0.0.0-20200709112050-ba3a7ba145b1/go.mod h1:jQWbuz96EMQTuxhanSY1imtK4zEjPrB1cM5wCKkk7l4= github.com/tribalwarshelp/golang-sdk v0.0.0-20200721095058-9ee3513a54a9/go.mod h1:wRoVfjxu4FozpiJmDknv5Zw4AOx/0IC+VttDaSTpBg8=
github.com/tribalwarshelp/shared v0.0.0-20200707075151-722e4a520a3c h1:wenSReGHPux51q5s+9Ji0TOHCt8Zx6whxsjx8Iv7aZg= github.com/tribalwarshelp/shared v0.0.0-20200721094728-9ea33a732990 h1:PwMCKm5Wvqq+tP3KvdqxPtxKtKZTaEONCBT5DvpbVrc=
github.com/tribalwarshelp/shared v0.0.0-20200707075151-722e4a520a3c/go.mod h1:tf+2yTHasV6jAF3V2deZ9slNoCyBzC0fMdTjI7clf6Y= github.com/tribalwarshelp/shared v0.0.0-20200721094728-9ea33a732990/go.mod h1:tf+2yTHasV6jAF3V2deZ9slNoCyBzC0fMdTjI7clf6Y=
github.com/vmihailenco/bufpool v0.1.5/go.mod h1:fL9i/PRTuS7AELqAHwSU1Zf1c70xhkhGe/cD5ud9pJk= github.com/vmihailenco/bufpool v0.1.5/go.mod h1:fL9i/PRTuS7AELqAHwSU1Zf1c70xhkhGe/cD5ud9pJk=
github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94= github.com/vmihailenco/bufpool v0.1.11 h1:gOq2WmBrq0i2yW5QJ16ykccQ4wH9UyEsgLm6czKAd94=
github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ= github.com/vmihailenco/bufpool v0.1.11/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ=

View File

@ -17,9 +17,9 @@
"help.observe": "**{{.Command}}** [group id from {{.GroupsCommand}}] [server] [tribe id] - command adds a tribe to the observation group.", "help.observe": "**{{.Command}}** [group id from {{.GroupsCommand}}] [server] [tribe id] - command adds a tribe to the observation group.",
"help.observations": "**{{.Command}}** [group id from {{.GroupsCommand}}] - shows a list of observed tribes by this group.", "help.observations": "**{{.Command}}** [group id from {{.GroupsCommand}}] - shows a list of observed tribes by this group.",
"help.deleteobservation": "**{{.Command}}** [group id from {{.GroupsCommand}}] [id from {{.ObservationsCommand}}] - removes a tribe from the observation group.", "help.deleteobservation": "**{{.Command}}** [group id from {{.GroupsCommand}}] [id from {{.ObservationsCommand}}] - removes a tribe from the observation group.",
"help.conqueredvillages": "**{{.Command}}** [group id from {{.GroupsCommand}}] - changes the channel on which notifications about conquered village will show. **IMPORTANT!** Call this command on the channel you want to display these notifications.", "help.conqueredvillages": "**{{.Command}}** [group id from {{.GroupsCommand}}] - changes the channel on which notifications about conquered village will show. **IMPORTANT!** Run this command on the channel you want to display these notifications.",
"help.disableconqueredvillages": "**{{.Command}}** [group id from {{.GroupsCommand}}] - disable notifications about conquered villages.", "help.disableconqueredvillages": "**{{.Command}}** [group id from {{.GroupsCommand}}] - disable notifications about conquered villages.",
"help.lostvillages": "**{{.Command}}** [group id from {{.GroupsCommand}}] - changes the channel on which notifications about lost village will show. **IMPORTANT!** Call this command on the channel you want to display these notifications.", "help.lostvillages": "**{{.Command}}** [group id from {{.GroupsCommand}}] - changes the channel on which notifications about lost village will show. **IMPORTANT!** Run this command on the channel you want to display these notifications.",
"help.disablelostvillages": "**{{.Command}}** [group id from {{.GroupsCommand}}] - disable notifications about lost villages.", "help.disablelostvillages": "**{{.Command}}** [group id from {{.GroupsCommand}}] - disable notifications about lost villages.",
"help.changelanguage": "**{{.Command}}** [{{.Languages}}] - change language.", "help.changelanguage": "**{{.Command}}** [{{.Languages}}] - change language.",
@ -91,7 +91,7 @@
"api.defaultError": "{{.Mention}} There was an error fetching data from the API, please try again later.", "api.defaultError": "{{.Mention}} There was an error fetching data from the API, please try again later.",
"pagination.labelDisplayedPage": "Page: {{.Page}} from {{.MaxPage}}", "pagination.labelDisplayedPage": "Page: {{.Page}} of {{.MaxPage}}",
"internalServerError": "{{.Mention}} Internal server error occurred, please try again later." "internalServerError": "{{.Mention}} Internal server error occurred, please try again later."
} }