diff --git a/cron/ennoblements.go b/cron/ennoblements.go index 4620b4b..10f693f 100644 --- a/cron/ennoblements.go +++ b/cron/ennoblements.go @@ -1,6 +1,7 @@ package cron import ( + "github.com/tribalwarshelp/dcbot/utils" shared_models "github.com/tribalwarshelp/shared/models" ) @@ -17,8 +18,8 @@ func (e ennoblements) getLastEnnoblement() *shared_models.LiveEnnoblement { func (e ennoblements) getLostVillagesByTribe(tribeID int) ennoblements { filtered := ennoblements{} for _, ennoblement := range e { - if (!isPlayerTribeNil(ennoblement.NewOwner) && ennoblement.NewOwner.Tribe.ID == tribeID) || - isPlayerTribeNil(ennoblement.OldOwner) || + if (!utils.IsPlayerTribeNil(ennoblement.NewOwner) && ennoblement.NewOwner.Tribe.ID == tribeID) || + utils.IsPlayerTribeNil(ennoblement.OldOwner) || ennoblement.OldOwner.Tribe.ID != tribeID { continue } @@ -30,9 +31,9 @@ func (e ennoblements) getLostVillagesByTribe(tribeID int) ennoblements { func (e ennoblements) getConqueredVillagesByTribe(tribeID int, showInternals bool) ennoblements { filtered := ennoblements{} for _, ennoblement := range e { - if isPlayerTribeNil(ennoblement.NewOwner) || + if utils.IsPlayerTribeNil(ennoblement.NewOwner) || ennoblement.NewOwner.Tribe.ID != tribeID || - (!showInternals && !isPlayerTribeNil(ennoblement.OldOwner) && ennoblement.OldOwner.Tribe.ID == tribeID) { + (!showInternals && !utils.IsPlayerTribeNil(ennoblement.OldOwner) && ennoblement.OldOwner.Tribe.ID == tribeID) { continue } filtered = append(filtered, ennoblement) diff --git a/cron/handler.go b/cron/handler.go index 58ceab9..ca11457 100644 --- a/cron/handler.go +++ b/cron/handler.go @@ -145,7 +145,7 @@ func (h *handler) checkEnnoblements() { if ok && langVersion != nil && langVersion.Host != "" { if group.LostVillagesChannelID != "" { for _, ennoblement := range ennoblements.getLostVillagesByTribe(observation.TribeID) { - if !isPlayerTribeNil(ennoblement.NewOwner) && + if !utils.IsPlayerTribeNil(ennoblement.NewOwner) && group.Observations.Contains(observation.Server, ennoblement.NewOwner.Tribe.ID) { continue } @@ -162,7 +162,7 @@ func (h *handler) checkEnnoblements() { if group.ConqueredVillagesChannelID != "" { for _, ennoblement := range ennoblements.getConqueredVillagesByTribe(observation.TribeID, group.ShowInternals) { - isInTheSameGroup := !isPlayerTribeNil(ennoblement.OldOwner) && + isInTheSameGroup := !utils.IsPlayerTribeNil(ennoblement.OldOwner) && group.Observations.Contains(observation.Server, ennoblement.OldOwner.Tribe.ID) if (!group.ShowInternals && isInTheSameGroup) || (!group.ShowEnnobledBarbarians && isBarbarian(ennoblement.OldOwner)) { diff --git a/cron/helpers.go b/cron/helpers.go index 1adb019..01feb32 100644 --- a/cron/helpers.go +++ b/cron/helpers.go @@ -1,9 +1,9 @@ package cron import ( - "fmt" "time" + "github.com/tribalwarshelp/dcbot/utils" shared_models "github.com/tribalwarshelp/shared/models" ) @@ -18,29 +18,10 @@ func filterEnnoblements(ennoblements []*shared_models.LiveEnnoblement, t time.Ti return filtered } -func isPlayerNil(player *shared_models.Player) bool { - return player == nil -} - -func isPlayerTribeNil(player *shared_models.Player) bool { - return isPlayerNil(player) || player.Tribe == nil -} - -func isVillageNil(village *shared_models.Village) bool { - return village == nil -} - func formatDateOfConquest(t time.Time) string { return t.Format(time.RFC3339) } -func formatMsgLink(text string, url string) string { - if url == "" { - return text - } - return fmt.Sprintf("[``%s``](%s)", text, url) -} - func isBarbarian(p *shared_models.Player) bool { - return isPlayerNil(p) || p.ID == 0 + return utils.IsPlayerNil(p) || p.ID == 0 } diff --git a/cron/message.go b/cron/message.go index e8d00b8..0890a46 100644 --- a/cron/message.go +++ b/cron/message.go @@ -1,9 +1,8 @@ package cron import ( - "fmt" - "github.com/nicksnyder/go-i18n/v2/i18n" + "github.com/tribalwarshelp/dcbot/discord" "github.com/tribalwarshelp/dcbot/message" "github.com/tribalwarshelp/dcbot/utils" shared_models "github.com/tribalwarshelp/shared/models" @@ -55,27 +54,23 @@ func newMessage(cfg newMessageConfig) checkEnnoblementsMsg { newOwnerTribeTag: "-", localizer: cfg.localizer, } - if !isVillageNil(cfg.ennoblement.Village) { - data.village = fmt.Sprintf("%s (%d|%d) %s", - cfg.ennoblement.Village.Name, - cfg.ennoblement.Village.X, - cfg.ennoblement.Village.Y, - cfg.ennoblement.Village.Continent()) + if !utils.IsVillageNil(cfg.ennoblement.Village) { + data.village = cfg.ennoblement.Village.FullName() data.villageURL = utils.FormatVillageURL(cfg.server, cfg.host, cfg.ennoblement.Village.ID) } - if !isPlayerNil(cfg.ennoblement.OldOwner) { + if !utils.IsPlayerNil(cfg.ennoblement.OldOwner) { data.oldOwnerName = cfg.ennoblement.OldOwner.Name data.oldOwnerURL = utils.FormatPlayerURL(cfg.server, cfg.host, cfg.ennoblement.OldOwner.ID) } - if !isPlayerTribeNil(cfg.ennoblement.OldOwner) { + if !utils.IsPlayerTribeNil(cfg.ennoblement.OldOwner) { data.oldOwnerTribeTag = cfg.ennoblement.OldOwner.Tribe.Tag data.oldOwnerTribeURL = utils.FormatTribeURL(cfg.server, cfg.host, cfg.ennoblement.OldOwner.Tribe.ID) } - if !isPlayerNil(cfg.ennoblement.NewOwner) { + if !utils.IsPlayerNil(cfg.ennoblement.NewOwner) { data.newOwnerName = cfg.ennoblement.NewOwner.Name data.newOwnerURL = utils.FormatPlayerURL(cfg.server, cfg.host, cfg.ennoblement.NewOwner.ID) } - if !isPlayerTribeNil(cfg.ennoblement.NewOwner) { + if !utils.IsPlayerTribeNil(cfg.ennoblement.NewOwner) { data.newOwnerTribeTag = cfg.ennoblement.NewOwner.Tribe.Tag data.newOwnerTribeURL = utils.FormatTribeURL(cfg.server, cfg.host, cfg.ennoblement.NewOwner.Tribe.ID) } @@ -89,11 +84,11 @@ func (msg checkEnnoblementsMsg) String() string { DefaultMessage: message.FallbackMsg("cron.checkEnnoblements.msgLine", "{{.NewOwner}} ({{.NewOwnerTribe}}) has conquered the village {{.Village}} (Old owner: {{.OldOwner}} ({{.OldOwnerTribe}}))"), TemplateData: map[string]interface{}{ - "NewOwner": formatMsgLink(msg.newOwnerName, msg.newOwnerURL), - "NewOwnerTribe": formatMsgLink(msg.newOwnerTribeTag, msg.newOwnerTribeURL), - "Village": formatMsgLink(msg.village, msg.villageURL), - "OldOwner": formatMsgLink(msg.oldOwnerName, msg.oldOwnerURL), - "OldOwnerTribe": formatMsgLink(msg.oldOwnerTribeTag, msg.oldOwnerTribeURL), + "NewOwner": discord.FormatLink(msg.newOwnerName, msg.newOwnerURL), + "NewOwnerTribe": discord.FormatLink(msg.newOwnerTribeTag, msg.newOwnerTribeURL), + "Village": discord.FormatLink(msg.village, msg.villageURL), + "OldOwner": discord.FormatLink(msg.oldOwnerName, msg.oldOwnerURL), + "OldOwnerTribe": discord.FormatLink(msg.oldOwnerTribeTag, msg.oldOwnerTribeURL), }, }) + "\n" } diff --git a/discord/coords_translation.go b/discord/coords_translation.go new file mode 100644 index 0000000..8354dff --- /dev/null +++ b/discord/coords_translation.go @@ -0,0 +1,163 @@ +package discord + +import ( + "context" + "regexp" + + "github.com/bwmarrin/discordgo" + "github.com/nicksnyder/go-i18n/v2/i18n" + "github.com/tribalwarshelp/dcbot/message" + "github.com/tribalwarshelp/dcbot/utils" + "github.com/tribalwarshelp/golang-sdk/sdk" + "github.com/tribalwarshelp/shared/models" +) + +const ( + coordsLimit = 20 + CoordsTranslationCommand Command = "coordstranslation" + DisableCoordsTranslationCommand Command = "disablecoordstranslation" +) + +var coordsRegex = regexp.MustCompile(`(\d+)\|(\d+)`) + +func (s *Session) handleCoordsTranslationCommand(ctx commandCtx, m *discordgo.MessageCreate, args ...string) { + if has, err := s.memberHasPermission(m.GuildID, m.Author.ID, discordgo.PermissionAdministrator); err != nil || !has { + return + } + + argsLength := len(args) + if argsLength > 1 { + s.sendUnknownCommandError(m.Author.Mention(), m.ChannelID, args[1:argsLength]...) + return + } else if argsLength < 1 { + s.SendMessage(m.ChannelID, + m.Author.Mention()+" "+ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "help.coordstranslation", + DefaultMessage: message.FallbackMsg("help.coordstranslation", + "**{{.Command}}** [server] - enable coords translation feature."), + TemplateData: map[string]interface{}{ + "Command": CoordsTranslationCommand.WithPrefix(s.cfg.CommandPrefix), + }, + })) + return + } + + serverKey := args[0] + server, err := s.cfg.API.Servers.Read(serverKey, nil) + if err != nil || server == nil { + s.SendMessage(m.ChannelID, + ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "coordsTranslation.serverNotFound", + DefaultMessage: message.FallbackMsg("coordsTranslation.serverNotFound", "{{.Mention}} Server not found."), + TemplateData: map[string]interface{}{ + "Mention": m.Author.Mention(), + }, + })) + return + } + + ctx.server.CoordsTranslation = serverKey + go s.cfg.ServerRepository.Update(context.Background(), ctx.server) + + s.SendMessage(m.ChannelID, + ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "coordsTranslation.success", + DefaultMessage: message.FallbackMsg("coordsTranslation.success", + "{{.Mention}} Coords translation feature has been enabled."), + TemplateData: map[string]interface{}{ + "Mention": m.Author.Mention(), + }, + })) +} + +func (s *Session) handleDisableCoordsTranslationCommand(ctx commandCtx, m *discordgo.MessageCreate, args ...string) { + if has, err := s.memberHasPermission(m.GuildID, m.Author.ID, discordgo.PermissionAdministrator); err != nil || !has { + return + } + + ctx.server.CoordsTranslation = "" + go s.cfg.ServerRepository.Update(context.Background(), ctx.server) + + s.SendMessage(m.ChannelID, + ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "disableCoordsTranslation.success", + DefaultMessage: message.FallbackMsg("disableCoordsTranslation.success", + "{{.Mention}} Coords translation feature has been disabled."), + TemplateData: map[string]interface{}{ + "Mention": m.Author.Mention(), + }, + })) +} + +func (s *Session) translateCoords(ctx commandCtx, m *discordgo.MessageCreate) { + if ctx.server.CoordsTranslation == "" { + return + } + coords := extractAllCoordsFromMessage(m.Content) + coordsLen := len(coords) + if coordsLen > 0 { + langVersion, err := s.cfg.API.LangVersions.Read(utils.LanguageTagFromWorldName(ctx.server.CoordsTranslation)) + if err != nil || langVersion == nil { + return + } + if coordsLen > coordsLimit { + coords = coords[0:coordsLimit] + } + list, err := s.cfg.API.Villages.Browse(ctx.server.CoordsTranslation, + &models.VillageFilter{ + XY: coords, + }, &sdk.VillageInclude{ + Player: true, + PlayerInclude: sdk.PlayerInclude{ + Tribe: true, + }, + }) + if err != nil || list == nil || list.Items == nil || len(list.Items) <= 0 { + return + } + + msg := &EmbedMessage{} + for _, village := range list.Items { + villageURL := utils.FormatVillageURL(ctx.server.CoordsTranslation, langVersion.Host, village.ID) + playerName := "-" + playerURL := "" + if !utils.IsPlayerNil(village.Player) { + playerName = village.Player.Name + playerURL = utils.FormatPlayerURL(ctx.server.CoordsTranslation, langVersion.Host, village.Player.ID) + } + tribeName := "-" + tribeURL := "" + if !utils.IsPlayerTribeNil(village.Player) { + tribeName = village.Player.Tribe.Name + tribeURL = utils.FormatTribeURL(ctx.server.CoordsTranslation, langVersion.Host, village.Player.Tribe.ID) + } + + msg.Append(ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "coordsTranslation.message", + DefaultMessage: message.FallbackMsg("coordsTranslation.message", + "{{.Village}} owned by {{.Player}} (Tribe: {{.Tribe}})."), + TemplateData: map[string]interface{}{ + "Village": FormatLink(village.FullName(), villageURL), + "Player": FormatLink(playerName, playerURL), + "Tribe": FormatLink(tribeName, tribeURL), + }, + })) + } + + s.SendEmbed(m.ChannelID, NewEmbed(). + SetTitle(ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "coordsTranslation.title", + DefaultMessage: message.FallbackMsg("coordsTranslation.title", "Villages"), + })). + SetFields(msg.ToMessageEmbedFields()). + MessageEmbed) + } +} + +func extractAllCoordsFromMessage(msg string) []string { + coords := []string{} + for _, bytes := range coordsRegex.FindAll([]byte(msg), -1) { + coords = append(coords, string(bytes)) + } + return coords +} diff --git a/discord/discord.go b/discord/discord.go index 9c5ffec..3bb9093 100644 --- a/discord/discord.go +++ b/discord/discord.go @@ -72,16 +72,36 @@ func (s *Session) SendMessage(channelID, message string) error { func (s *Session) SendEmbed(channelID string, message *discordgo.MessageEmbed) error { fields := message.Fields - - for i := 0; i < len(fields); i += EmbedLimitField { - end := i + EmbedLimitField - - if end > len(fields) { - end = len(fields) + baseNumberOfCharacters := len(message.Description) + len(message.Title) + if message.Author != nil { + baseNumberOfCharacters += len(message.Author.Name) + } + if message.Footer != nil { + baseNumberOfCharacters += len(message.Footer.Text) + } + splittedFields := [][]*discordgo.MessageEmbedField{} + characters := baseNumberOfCharacters + fromIndex := 0 + for index, field := range fields { + if characters+len(field.Name)+len(field.Value) > EmbedLimit || index == len(fields)-1 { + splittedFields = append(splittedFields, fields[fromIndex:index+1]) + fromIndex = index + characters = baseNumberOfCharacters } - message.Fields = fields[i:end] - if _, err := s.dg.ChannelMessageSendEmbed(channelID, message); err != nil { - return err + characters += len(field.Name) + characters += len(field.Value) + } + for _, fields := range splittedFields { + for i := 0; i < len(fields); i += EmbedLimitField { + end := i + EmbedLimitField + + if end > len(fields) { + end = len(fields) + } + message.Fields = fields[i:end] + if _, err := s.dg.ChannelMessageSendEmbed(channelID, message); err != nil { + return err + } } } @@ -142,14 +162,12 @@ func (s *Session) handleNewMessage(_ *discordgo.Session, m *discordgo.MessageCre s.handleDeleteGroupCommand(ctx, m, args...) case GroupsCommand.WithPrefix(s.cfg.CommandPrefix): s.handleGroupsCommand(ctx, m) - case ObserveCommand.WithPrefix(s.cfg.CommandPrefix): s.handleObserveCommand(ctx, m, args...) case DeleteObservationCommand.WithPrefix(s.cfg.CommandPrefix): s.handleDeleteObservationCommand(ctx, m, args...) case ObservationsCommand.WithPrefix(s.cfg.CommandPrefix): s.handleObservationsCommand(ctx, m, args...) - case ConqueredVillagesCommand.WithPrefix(s.cfg.CommandPrefix): s.handleConqueredVillagesCommand(ctx, m, args...) case DisableConqueredVillagesCommand.WithPrefix(s.cfg.CommandPrefix): @@ -158,12 +176,18 @@ func (s *Session) handleNewMessage(_ *discordgo.Session, m *discordgo.MessageCre s.handleLostVillagesCommand(ctx, m, args...) case DisableLostVillagesCommand.WithPrefix(s.cfg.CommandPrefix): s.handleDisableLostVillagesCommand(ctx, m, args...) - case ShowEnnobledBarbariansCommand.WithPrefix(s.cfg.CommandPrefix): s.handleShowEnnobledBarbariansCommand(ctx, m, args...) case ShowInternalsCommand.WithPrefix(s.cfg.CommandPrefix): s.handleShowInternalsCommand(ctx, m, args...) + case CoordsTranslationCommand.WithPrefix(s.cfg.CommandPrefix): + s.handleCoordsTranslationCommand(ctx, m, args...) + case DisableCoordsTranslationCommand.WithPrefix(s.cfg.CommandPrefix): + s.handleDisableCoordsTranslationCommand(ctx, m, args...) + + default: + s.translateCoords(ctx, m) } } diff --git a/discord/embed.go b/discord/embed.go index 092fcf7..ee9ed17 100644 --- a/discord/embed.go +++ b/discord/embed.go @@ -15,7 +15,7 @@ const ( EmbedLimitFieldName = 256 EmbedLimitField = 25 EmbedLimitFooter = 2048 - EmbedLimit = 4000 + EmbedLimit = 5500 ) type Embed struct { diff --git a/discord/helpers.go b/discord/helpers.go index 064a52e..8cc4f76 100644 --- a/discord/helpers.go +++ b/discord/helpers.go @@ -1,6 +1,7 @@ package discord import ( + "fmt" "strings" "github.com/tribalwarshelp/dcbot/message" @@ -13,3 +14,10 @@ func getAvailableLanguages() string { } return strings.Join(langTags, " | ") } + +func FormatLink(text string, url string) string { + if url == "" { + return text + } + return fmt.Sprintf("[``%s``](%s)", text, url) +} diff --git a/discord/admin_commands.go b/discord/observations.go similarity index 100% rename from discord/admin_commands.go rename to discord/observations.go index cf97997..52f2046 100644 --- a/discord/admin_commands.go +++ b/discord/observations.go @@ -979,8 +979,8 @@ func (s *Session) handleChangeLanguageCommand(ctx commandCtx, m *discordgo.Messa "Mention": m.Author.Mention(), }, })) - } + func (s *Session) handleShowInternalsCommand(ctx commandCtx, m *discordgo.MessageCreate, args ...string) { if has, err := s.memberHasPermission(m.GuildID, m.Author.ID, discordgo.PermissionAdministrator); err != nil || !has { return diff --git a/discord/public_commands.go b/discord/public_commands.go index adc23f5..13f1013 100644 --- a/discord/public_commands.go +++ b/discord/public_commands.go @@ -183,6 +183,8 @@ func (s *Session) handleHelpCommand(ctx commandCtx, m *discordgo.MessageCreate) - %s - %s - %s +- %s +- %s - %s `, ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ @@ -203,6 +205,15 @@ func (s *Session) handleHelpCommand(ctx commandCtx, m *discordgo.MessageCreate) "GroupsCommand": GroupsCommand.WithPrefix(s.cfg.CommandPrefix), }, }), + ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "help.showinternals", + DefaultMessage: message.FallbackMsg("help.showinternals", + "**{{.Command}}** [group id from {{.GroupsCommand}}] - enables/disables notifications about in-group/in-tribe conquering."), + TemplateData: map[string]interface{}{ + "Command": ShowInternalsCommand.WithPrefix(s.cfg.CommandPrefix), + "GroupsCommand": GroupsCommand.WithPrefix(s.cfg.CommandPrefix), + }, + }), ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ MessageID: "help.changelanguage", DefaultMessage: message.FallbackMsg("help.changelanguage", @@ -213,12 +224,19 @@ func (s *Session) handleHelpCommand(ctx commandCtx, m *discordgo.MessageCreate) }, }), ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ - MessageID: "help.showinternals", - DefaultMessage: message.FallbackMsg("help.showinternals", - "**{{.Command}}** [group id from {{.GroupsCommand}}] - enables/disables notifications about in-group/in-tribe conquering."), + MessageID: "help.coordstranslation", + DefaultMessage: message.FallbackMsg("help.coordstranslation", + "**{{.Command}}** [server] - enable coords translation feature."), TemplateData: map[string]interface{}{ - "Command": ShowInternalsCommand.WithPrefix(s.cfg.CommandPrefix), - "GroupsCommand": GroupsCommand.WithPrefix(s.cfg.CommandPrefix), + "Command": CoordsTranslationCommand.WithPrefix(s.cfg.CommandPrefix), + }, + }), + ctx.localizer.MustLocalize(&i18n.LocalizeConfig{ + MessageID: "help.disablecoordstranslation", + DefaultMessage: message.FallbackMsg("help.disablecoordstranslation", + "**{{.Command}}** - disable coords translation feature."), + TemplateData: map[string]interface{}{ + "Command": DisableCoordsTranslationCommand.WithPrefix(s.cfg.CommandPrefix), }, }), ) diff --git a/go.mod b/go.mod index b8a45ee..fcaef1c 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,8 @@ require ( github.com/pkg/errors v0.9.1 github.com/robfig/cron/v3 v3.0.1 github.com/segmentio/encoding v0.1.14 // indirect - github.com/tribalwarshelp/golang-sdk v0.0.0-20200727153039-1b7b21ad36a9 - github.com/tribalwarshelp/shared v0.0.0-20200721124533-776cbb36074b + github.com/tribalwarshelp/golang-sdk v0.0.0-20200809132742-4b93c9b8ef78 + github.com/tribalwarshelp/shared v0.0.0-20200809135300-8ead1165291b golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 // indirect golang.org/x/text v0.3.2 ) diff --git a/go.sum b/go.sum index 2fdb65e..e728578 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,20 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.0/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7 h1:qELHH0AWCvf98Yf+CNIJx9vOZOfHFDDzgDRYsnNk/vs= github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7/go.mod h1:Q5DbzQ+3AkgGwymQO7aZFNP7ns2lZKGtvRBzRXfdi60= github.com/Kichiyaki/gqlgen-client v0.0.0-20200604145848-274796c104f4 h1:QiOarkkKHdFYI+0m6F1H3rRzP6DqJsKJVLirGXEHGSU= github.com/Kichiyaki/gqlgen-client v0.0.0-20200604145848-274796c104f4/go.mod h1:weCVl47ZANyeX60sdsSl0bWHf8HWXyVFmlGHHCR/i5M= github.com/benbjohnson/clock v1.0.0 h1:78Jk/r6m4wCi6sndMpty7A//t4dw/RW5fV4ZgDVfX1w= github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= +github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/bwmarrin/discordgo v0.20.3 h1:AxjcHGbyBFSC0a3Zx5nDQwbOjU7xai5dXjRnZ0YB7nU= github.com/bwmarrin/discordgo v0.20.3/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/codemodus/kace v0.5.1 h1:4OCsBlE2c/rSJo375ggfnucv9eRzge/U5LrrOZd47HA= @@ -19,12 +23,14 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgryski/go-rendezvous v0.0.0-20200624174652-8d2f3be8b2d9/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-pg/pg/v10 v10.0.0-beta.2 h1:8tNEJLtOEw5/Df0BLLBOHCiLaYAiu4uhdngjK955MK8= github.com/go-pg/pg/v10 v10.0.0-beta.2/go.mod h1:UAuqGPC94ySi4rJ3DC5e4SY1rlwugZbJA/XoJ/kf5Rw= github.com/go-pg/pg/v9 v9.0.0-beta.14/go.mod h1:T2Sr6bpTCOr2lUqOUMiXLMJqZHSUBKk1LdgSqjwhZfA= @@ -38,6 +44,7 @@ github.com/go-pg/urlstruct v0.4.0 h1:3lmbUGYQclB3UOx9akDs2T251zwkKQuPkvPTmCm07+A github.com/go-pg/urlstruct v0.4.0/go.mod h1:/XKyiUOUUS3onjF+LJxbfmSywYAdl6qMfVbX33Q8rgg= github.com/go-pg/zerochecker v0.1.1 h1:av77Qe7Gs+1oYGGh51k0sbZ0bUaxJEdeP0r8YE64Dco= github.com/go-pg/zerochecker v0.1.1/go.mod h1:NJZ4wKL0NmTtz0GKCoJ8kym6Xn/EQzXRl2OnAe7MmDo= +github.com/go-redis/redis/v8 v8.0.0-beta.7/go.mod h1:FGJAWDWFht1sQ4qxyJHZZbVyvnVcKQN0E3u5/5lRz+g= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -59,6 +66,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= @@ -84,6 +92,7 @@ github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+ github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opentracing/opentracing-go v1.1.1-0.20190913142402-a7454ce5950e/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -97,12 +106,14 @@ github.com/segmentio/encoding v0.1.13/go.mod h1:RWhr02uzMB9gQC1x+MfYxedtmBibb9cZ github.com/segmentio/encoding v0.1.14 h1:BfnglNbNRohLaBLf93uP5/IwKqeWrezXK/g6IRnj75c= github.com/segmentio/encoding v0.1.14/go.mod h1:RWhr02uzMB9gQC1x+MfYxedtmBibb9cZ6Vv9VxRSSbw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.0 h1:jlIyCplCJFULU/01vCkhKuTyc3OorI3bJFuw6obfgho= github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.6.1/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/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= github.com/tribalwarshelp/golang-sdk v0.0.0-20200721095058-9ee3513a54a9 h1:y4fY0Ax8/OUMWvRFr9FkZ9QrKSi4MKsbovt31J3N+us= @@ -111,10 +122,16 @@ github.com/tribalwarshelp/golang-sdk v0.0.0-20200727152443-be3c1217e00a h1:3INKm github.com/tribalwarshelp/golang-sdk v0.0.0-20200727152443-be3c1217e00a/go.mod h1:wRoVfjxu4FozpiJmDknv5Zw4AOx/0IC+VttDaSTpBg8= github.com/tribalwarshelp/golang-sdk v0.0.0-20200727153039-1b7b21ad36a9 h1:xjCeZkqxGOC6hDirgHAIAeXianzRs5gN0pNgPlRQnNg= github.com/tribalwarshelp/golang-sdk v0.0.0-20200727153039-1b7b21ad36a9/go.mod h1:wRoVfjxu4FozpiJmDknv5Zw4AOx/0IC+VttDaSTpBg8= +github.com/tribalwarshelp/golang-sdk v0.0.0-20200809132742-4b93c9b8ef78 h1:dDfIVlWwOP9Gm//4WxrcqD3y+znVC0GhFgdo1Y5pYAg= +github.com/tribalwarshelp/golang-sdk v0.0.0-20200809132742-4b93c9b8ef78/go.mod h1:o1ViLff0Fwg4LH86VDaBtUQqIIMIqp+leUBx+fZLz/U= github.com/tribalwarshelp/shared v0.0.0-20200721094728-9ea33a732990 h1:PwMCKm5Wvqq+tP3KvdqxPtxKtKZTaEONCBT5DvpbVrc= github.com/tribalwarshelp/shared v0.0.0-20200721094728-9ea33a732990/go.mod h1:tf+2yTHasV6jAF3V2deZ9slNoCyBzC0fMdTjI7clf6Y= github.com/tribalwarshelp/shared v0.0.0-20200721124533-776cbb36074b h1:8bgZG6Zi3ROqtvpeUOj3a19mtES88VjeNwkUF0FI+Vs= github.com/tribalwarshelp/shared v0.0.0-20200721124533-776cbb36074b/go.mod h1:tf+2yTHasV6jAF3V2deZ9slNoCyBzC0fMdTjI7clf6Y= +github.com/tribalwarshelp/shared v0.0.0-20200809125423-2bc2e8dfde95 h1:mO3ZR+o5UlYN8uGX4L32H5HNpB0uHpLdZ3YiDA6ciW4= +github.com/tribalwarshelp/shared v0.0.0-20200809125423-2bc2e8dfde95/go.mod h1:SSWchTkQdgeIDr0C68C7zopEIcBLCUa8Ic2CHenUaac= +github.com/tribalwarshelp/shared v0.0.0-20200809135300-8ead1165291b h1:Tw7IC7cgc3UUeShf8ld/uQwnUEROm2R8fgpKpwy2qwU= +github.com/tribalwarshelp/shared v0.0.0-20200809135300-8ead1165291b/go.mod h1:SSWchTkQdgeIDr0C68C7zopEIcBLCUa8Ic2CHenUaac= 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/go.mod h1:AFf/MOy3l2CFTKbxwt0mp2MwnqjNEs5H/UxrkA5jxTQ= @@ -129,20 +146,31 @@ github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37w github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= go.opentelemetry.io/otel v0.6.0 h1:+vkHm/XwJ7ekpISV2Ixew93gCrxTbuwTF5rSewnLLgw= go.opentelemetry.io/otel v0.6.0/go.mod h1:jzBIgIzK43Iu1BpDAXwqOd6UPsSAk+ewVZ5ofSXw4Ek= +go.opentelemetry.io/otel v0.7.0/go.mod h1:aZMyHG5TqDOXEgH2tyLiXSUKly1jT3yqE9PmrzIeCdo= +go.opentelemetry.io/otel v0.9.0 h1:nsdCDHzQx1Yv8E2nwCPcMXMfg+EMIlx1LBOXNC8qSQ8= +go.opentelemetry.io/otel v0.9.0/go.mod h1:ckxzUEfk7tAkTwEMVdkllBM+YOfE/K9iwg6zYntFYSg= golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191128160524-b544559bb6d1/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM= golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20200513190911-00229845015e/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -152,6 +180,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190420063019-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -166,9 +196,11 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y= @@ -185,6 +217,8 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -204,6 +238,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0 h1:M5a8xTlYTxwMn5ZFkwhRabsygDY5G8TYLyQDBxJNAxE= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/message/translations/active.en.json b/message/translations/active.en.json index 1c6cf22..839f6cd 100644 --- a/message/translations/active.en.json +++ b/message/translations/active.en.json @@ -23,6 +23,8 @@ "help.disablelostvillages": "**{{.Command}}** [group id from {{.GroupsCommand}}] - disable notifications about lost villages.", "help.changelanguage": "**{{.Command}}** [{{.Languages}}] - change language.", "help.showinternals": "**{{.Command}}** [group id from {{.GroupsCommand}}] - enables/disables notifications about in-group/in-tribe conquering.", + "help.coordstranslation": "**{{.Command}}** [server] - enable coords translation feature.", + "help.disablecoordstranslation": "**{{.Command}}** - disable coords translation feature.", "tribe.invalidPage": "{{.Mention}} The page must be a number greater than 0.", "tribe.noTribeID": "{{.Mention}} You haven't entered the tribe ID.", @@ -92,6 +94,13 @@ "showInternals.success_1": "{{.Mention}} Notifications about internals will no longer show up.", "showInternals.success_2": "{{.Mention}} Enabled notifications about internals.", + "coordsTranslation.title": "Villages", + "coordsTranslation.message": "{{.Village}} owned by {{.Player}} (Tribe: {{.Tribe}}).", + "coordsTranslation.serverNotFound": "{{.Mention}} Server not found.", + "coordsTranslation.success": "{{.Mention}} Coords translation feature has been enabled.", + + "disableCoordsTranslation.success": "{{.Mention}} Coords translation feature has been disabled.", + "cron.lostVillages.title": "Lost villages", "cron.conqueredVillages.title": "Conquered villages", "cron.checkEnnoblements.msgLine": "{{.NewOwner}} [{{.NewOwnerTribe}}] conquered {{.Village}} (Old owner: {{.OldOwner}} [{{.OldOwnerTribe}}])", diff --git a/message/translations/active.pl.json b/message/translations/active.pl.json index 284e2f5..271526f 100644 --- a/message/translations/active.pl.json +++ b/message/translations/active.pl.json @@ -21,8 +21,10 @@ "help.disableconqueredvillages": "**{{.Command}}** [id grupy z {{.GroupsCommand}}] - wyłącza powiadomienia o podbitych wioskach w danej grupie.", "help.lostvillages": "**{{.Command}}** [id grupy z {{.GroupsCommand}}] - zmienia kanał na którym będą się pojawiać informację o straconych wioskach w danej grupie. **WAŻNE!** Wywołaj tę komendę na kanale na którym chcesz dostawać te powiadomienia.", "help.disablelostvillages": "**{{.Command}}** [id grupy z {{.GroupsCommand}}] - wyłącza powiadomienia o straconych wioskach w danej grupie.", - "help.changelanguage": "**{{.Command}}** [{{.Languages}}] - zmień język.", + "help.changelanguage": "**{{.Command}}** [{{.Languages}}] - zmień język bota.", "help.showinternals": "**{{.Command}}** [id grupy z {{.GroupsCommand}}] - włącza/wyłącza notyfikacje o podbiciach plemion należących do jednej grupy.", + "help.coordstranslation": "**{{.Command}}** [serwer] - włącz translator koordynat.", + "help.disablecoordstranslation": "**{{.Command}}** - wyłącz translator koordynat.", "tribe.invalidPage": "{{.Mention}} Strona musi być liczbą większą od 0.", "tribe.noTribeID": "{{.Mention}} Nie wprowadziłeś ID plemienia.", @@ -92,6 +94,13 @@ "changeLanguage.languageNotSupported": "{{.Mention}} Język nie jest obsługiwany.", "changeLanguage.success": "{{.Mention}} Język został zmieniony.", + "coordsTranslation.title": "Wioski", + "coordsTranslation.message": "{{.Village}} należąca do {{.Player}} (Plemię: {{.Tribe}}).", + "coordsTranslation.serverNotFound": "{{.Mention}} Serwer nie został znaleziony.", + "coordsTranslation.success": "{{.Mention}} Translator koordynat został włączony.", + + "disableCoordsTranslation.success": "{{.Mention}} Translator koordynat został wyłączony.", + "cron.lostVillages.title": "Stracone wioski", "cron.conqueredVillages.title": "Podbite wioski", "cron.checkEnnoblements.msgLine": "{{.NewOwner}} [{{.NewOwnerTribe}}] podbił wioskę {{.Village}} (Poprzedni właściciel: {{.OldOwner}} [{{.OldOwnerTribe}}])", diff --git a/models/server.go b/models/server.go index eefaa1d..ec2699b 100644 --- a/models/server.go +++ b/models/server.go @@ -3,10 +3,12 @@ package models type Server struct { tableName struct{} `pg:",alias:server"` - ID string `pg:",pk" json:"id" gqlgen:"id"` - Lang string `pg:",use_zero"` - Groups []*Group + ID string `pg:",pk" json:"id" gqlgen:"id"` + Lang string `pg:",use_zero"` + CoordsTranslation string `pg:",use_zero"` + Groups []*Group } + type ServerFilter struct { tableName struct{} `urlstruct:"server"` diff --git a/utils/format_tribalwars_url.go b/utils/tribalwars.go similarity index 66% rename from utils/format_tribalwars_url.go rename to utils/tribalwars.go index c537002..5442ae8 100644 --- a/utils/format_tribalwars_url.go +++ b/utils/tribalwars.go @@ -1,6 +1,10 @@ package utils -import "fmt" +import ( + "fmt" + + "github.com/tribalwarshelp/shared/models" +) const ( endpointTribeProfile = "/game.php?screen=info_ally&id=%d" @@ -19,3 +23,15 @@ func FormatTribeURL(world, host string, id int) string { func FormatPlayerURL(world, host string, id int) string { return fmt.Sprintf("https://%s.%s"+endpointPlayerProfile, world, host, id) } + +func IsPlayerNil(player *models.Player) bool { + return player == nil +} + +func IsPlayerTribeNil(player *models.Player) bool { + return IsPlayerNil(player) || player.Tribe == nil +} + +func IsVillageNil(village *models.Village) bool { + return village == nil +}