diff --git a/lib/broadcaster/broadcaster.go b/lib/broadcaster/broadcaster.go index f7e551b..60c0b96 100644 --- a/lib/broadcaster/broadcaster.go +++ b/lib/broadcaster/broadcaster.go @@ -4,8 +4,9 @@ package broadcaster import ( - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "time" + + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) func (b *Broadcaster) createBroadcastMessage(playerRaw *dbmapping.Player, messageBody string, broadcastType string) (dbmapping.Broadcast, bool) { diff --git a/lib/connections/connections.go b/lib/connections/connections.go index 9a32bbf..2aded03 100644 --- a/lib/connections/connections.go +++ b/lib/connections/connections.go @@ -5,10 +5,10 @@ package connections import ( "bitbucket.org/pztrn/mogrus" - "source.wtfteam.pro/i2_bot/i2_bot/lib/config" _ "github.com/go-sql-driver/mysql" "github.com/go-telegram-bot-api/telegram-bot-api" "github.com/jmoiron/sqlx" + "source.wtfteam.pro/i2_bot/i2_bot/lib/config" ) // BotInit initializes connection to Telegram diff --git a/lib/datacache/chats.go b/lib/datacache/chats.go index e1827b4..044b90c 100644 --- a/lib/datacache/chats.go +++ b/lib/datacache/chats.go @@ -5,10 +5,11 @@ package datacache import ( "errors" - "github.com/go-telegram-bot-api/telegram-bot-api" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "time" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) func (dc *DataCache) initChats() { diff --git a/lib/datacache/elements.go b/lib/datacache/elements.go index c387c7e..c86a018 100644 --- a/lib/datacache/elements.go +++ b/lib/datacache/elements.go @@ -5,10 +5,11 @@ package datacache import ( "errors" + "strconv" + "gopkg.in/yaml.v2" "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" "source.wtfteam.pro/i2_bot/i2_bot/static" - "strconv" ) func (dc *DataCache) initElements() { diff --git a/lib/datacache/exported.go b/lib/datacache/exported.go index e504ee3..63d3bf6 100644 --- a/lib/datacache/exported.go +++ b/lib/datacache/exported.go @@ -4,11 +4,12 @@ package datacache import ( + "sync" + "source.wtfteam.pro/i2_bot/i2_bot/lib/appcontext" "source.wtfteam.pro/i2_bot/i2_bot/lib/datacache/datacacheinterface" "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" - "sync" ) var ( diff --git a/lib/datacache/leagues.go b/lib/datacache/leagues.go index 246f210..5273322 100644 --- a/lib/datacache/leagues.go +++ b/lib/datacache/leagues.go @@ -5,10 +5,11 @@ package datacache import ( "errors" + "strconv" + "gopkg.in/yaml.v2" "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" "source.wtfteam.pro/i2_bot/i2_bot/static" - "strconv" ) func (dc *DataCache) initLeagues() { diff --git a/lib/datacache/levels.go b/lib/datacache/levels.go index f412139..fff33e7 100644 --- a/lib/datacache/levels.go +++ b/lib/datacache/levels.go @@ -5,10 +5,11 @@ package datacache import ( "errors" + "strconv" + "gopkg.in/yaml.v2" "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" "source.wtfteam.pro/i2_bot/i2_bot/static" - "strconv" ) func (dc *DataCache) initLevels() { diff --git a/lib/datacache/locations.go b/lib/datacache/locations.go index 49d696c..e8a834e 100644 --- a/lib/datacache/locations.go +++ b/lib/datacache/locations.go @@ -5,10 +5,11 @@ package datacache import ( "errors" + "strconv" + "gopkg.in/yaml.v2" "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" "source.wtfteam.pro/i2_bot/i2_bot/static" - "strconv" ) func (dc *DataCache) initLocations() { diff --git a/lib/datacache/players.go b/lib/datacache/players.go index 764cde9..e3ce1ef 100644 --- a/lib/datacache/players.go +++ b/lib/datacache/players.go @@ -5,9 +5,10 @@ package datacache import ( "errors" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "time" + + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) func (dc *DataCache) initPlayers() { diff --git a/lib/datacache/pokememes.go b/lib/datacache/pokememes.go index 5eabace..a8d6133 100644 --- a/lib/datacache/pokememes.go +++ b/lib/datacache/pokememes.go @@ -5,11 +5,12 @@ package datacache import ( "errors" + "strconv" + "strings" + "gopkg.in/yaml.v2" "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" "source.wtfteam.pro/i2_bot/i2_bot/static" - "strconv" - "strings" ) func (dc *DataCache) initPokememes() { diff --git a/lib/datacache/profiles.go b/lib/datacache/profiles.go index 912d524..39066eb 100644 --- a/lib/datacache/profiles.go +++ b/lib/datacache/profiles.go @@ -5,8 +5,9 @@ package datacache import ( "errors" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" + + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) func (dc *DataCache) initProfiles() { diff --git a/lib/datacache/squads.go b/lib/datacache/squads.go index e5db4f3..4f01fd1 100644 --- a/lib/datacache/squads.go +++ b/lib/datacache/squads.go @@ -5,8 +5,9 @@ package datacache import ( "errors" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" + + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) func (dc *DataCache) initSquads() { diff --git a/lib/datacache/weapons.go b/lib/datacache/weapons.go index 24323cd..e5edeec 100644 --- a/lib/datacache/weapons.go +++ b/lib/datacache/weapons.go @@ -5,11 +5,12 @@ package datacache import ( "errors" + "strconv" + "strings" + "gopkg.in/yaml.v2" "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" "source.wtfteam.pro/i2_bot/i2_bot/static" - "strconv" - "strings" ) func (dc *DataCache) initWeapons() { diff --git a/lib/dbmapping/orders.go b/lib/dbmapping/orders.go index 1d2000f..697b3b8 100644 --- a/lib/dbmapping/orders.go +++ b/lib/dbmapping/orders.go @@ -4,8 +4,9 @@ package dbmapping import ( - "github.com/go-sql-driver/mysql" "time" + + "github.com/go-sql-driver/mysql" ) // Order is a struct, which represents `orders` table item in databse. diff --git a/lib/dbmapping/players.go b/lib/dbmapping/players.go index 039f88c..041334f 100644 --- a/lib/dbmapping/players.go +++ b/lib/dbmapping/players.go @@ -4,8 +4,9 @@ package dbmapping import ( - "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" "time" + + "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" ) // Player is a struct, which represents `players` table item in databse. diff --git a/lib/dbmapping/pokememes_elements.go b/lib/dbmapping/pokememes_elements.go deleted file mode 100644 index 3cc0130..0000000 --- a/lib/dbmapping/pokememes_elements.go +++ /dev/null @@ -1,16 +0,0 @@ -// i2_bot – Instinct PokememBro Bot -// Copyright (c) 2017 Vladimir "fat0troll" Hodakov - -package dbmapping - -import ( - "time" -) - -// PokememeElement is a struct, which represents `pokememes_elements` table item in databse. -type PokememeElement struct { - ID int `db:"id"` - PokememeID int `db:"pokememe_id"` - ElementID int `db:"element_id"` - CreatedAt time.Time `db:"created_at"` -} diff --git a/lib/dbmapping/pokememes_locations.go b/lib/dbmapping/pokememes_locations.go deleted file mode 100644 index 3af9d84..0000000 --- a/lib/dbmapping/pokememes_locations.go +++ /dev/null @@ -1,16 +0,0 @@ -// i2_bot – Instinct PokememBro Bot -// Copyright (c) 2017 Vladimir "fat0troll" Hodakov - -package dbmapping - -import ( - "time" -) - -// PokememeLocation is a struct, which represents `pokememes_locations` table item in databse. -type PokememeLocation struct { - ID int `db:"id"` - PokememeID int `db:"pokememe_id"` - LocationID int `db:"location_id"` - CreatedAt time.Time `db:"created_at"` -} diff --git a/lib/dbmapping/profiles.go b/lib/dbmapping/profiles.go index 24b2d03..b3817bf 100644 --- a/lib/dbmapping/profiles.go +++ b/lib/dbmapping/profiles.go @@ -4,7 +4,6 @@ package dbmapping import ( - "math" "time" ) @@ -22,18 +21,12 @@ type Profile struct { EggExp int `db:"egg_exp"` Power int `db:"power"` WeaponID int `db:"weapon_id"` - Crystalls int `db:"crystalls"` + Crystals int `db:"crystalls"` CreatedAt time.Time `db:"created_at"` } -// FullExp returns exp points in summary, gained after registration -func (p *Profile) FullExp() int { - fullExp := 0.00 - - for i := 1; i < p.LevelID+1; i++ { - fullExp = fullExp + (100 * math.Pow(2.0, float64(i))) - } - - fullExp += float64(p.Exp) - return int(fullExp) +// ProfileWithPokememes is a struct, which represents full profile with current hand +type ProfileWithPokememes struct { + Profile Profile + Pokememes ProfilePokememe } diff --git a/lib/forwarder/forwarder.go b/lib/forwarder/forwarder.go index 90151f9..2ac14d2 100644 --- a/lib/forwarder/forwarder.go +++ b/lib/forwarder/forwarder.go @@ -4,18 +4,19 @@ package forwarder import ( - "github.com/go-telegram-bot-api/telegram-bot-api" "regexp" + + "github.com/go-telegram-bot-api/telegram-bot-api" "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // ProcessForward process forwards for single-user chats func (f *Forwarder) ProcessForward(update *tgbotapi.Update, playerRaw *dbmapping.Player) string { text := update.Message.Text + // Forwards var pokememeMsg = regexp.MustCompile(`Dex(.+)\nGrade(.+)\nName(.+)`) - var profileMsg = regexp.MustCompile(`(Онлайн: )(\d+)(| Турнир: )(.+)\n(.+)\n(.+)\n(👤Уровень)(.+)\n`) - var profileWithEffectsMsg = regexp.MustCompile(`(Онлайн: )(\d+)(| Турнир: )(.+)\n(.+)\n(.+)\n(.+)\n(👤Уровень)(.+)\n`) + var profileMsg = regexp.MustCompile(`id(\s)(\d+)\n(Team)(\s)([А-Я]+)\nName(\s)(.*)\nLvl(\s)(\d+)`) switch { case pokememeMsg.MatchString(text): @@ -28,8 +29,6 @@ func (f *Forwarder) ProcessForward(update *tgbotapi.Update, playerRaw *dbmapping case profileMsg.MatchString(text): c.Log.Debug("Profile posted!") return c.Users.ParseProfile(update, playerRaw) - case profileWithEffectsMsg.MatchString(text): - return c.Users.ProfileAddEffectsMessage(update) default: c.Log.Debug(text) } diff --git a/lib/orders/orders.go b/lib/orders/orders.go index 6f8d5d4..e9e14db 100644 --- a/lib/orders/orders.go +++ b/lib/orders/orders.go @@ -4,10 +4,11 @@ package orders import ( - "github.com/go-telegram-bot-api/telegram-bot-api" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // Internal functions diff --git a/lib/orders/responders.go b/lib/orders/responders.go index 3001340..674c26b 100644 --- a/lib/orders/responders.go +++ b/lib/orders/responders.go @@ -4,8 +4,9 @@ package orders import ( - "github.com/go-telegram-bot-api/telegram-bot-api" "strconv" + + "github.com/go-telegram-bot-api/telegram-bot-api" ) // ListAllOrders returns to user all orders in database diff --git a/lib/pinner/pinner.go b/lib/pinner/pinner.go index fdee762..61124c6 100644 --- a/lib/pinner/pinner.go +++ b/lib/pinner/pinner.go @@ -4,10 +4,11 @@ package pinner import ( - "github.com/go-telegram-bot-api/telegram-bot-api" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) func (p *Pinner) execMassMessagePin(update *tgbotapi.Update, groupChats []dbmapping.Chat) string { diff --git a/lib/pokedexer/getters.go b/lib/pokedexer/getters.go index 2efe1fd..78250de 100644 --- a/lib/pokedexer/getters.go +++ b/lib/pokedexer/getters.go @@ -5,9 +5,10 @@ package pokedexer import ( "sort" - "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" "strconv" "strings" + + "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" ) func (p *Pokedexer) getAdvicePokememes(playerID int, adviceType string) ([]*datamapping.PokememeFull, bool) { diff --git a/lib/pokedexer/parsers.go b/lib/pokedexer/parsers.go index 3786aa6..a8fe7b5 100644 --- a/lib/pokedexer/parsers.go +++ b/lib/pokedexer/parsers.go @@ -4,10 +4,11 @@ package pokedexer import ( - "github.com/go-telegram-bot-api/telegram-bot-api" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // ParsePokememe parses pokememe, forwarded from PokememeBroBot, to database diff --git a/lib/pokedexer/pokedexer.go b/lib/pokedexer/pokedexer.go index c5ecc45..03ebc7e 100644 --- a/lib/pokedexer/pokedexer.go +++ b/lib/pokedexer/pokedexer.go @@ -4,10 +4,11 @@ package pokedexer import ( - "github.com/go-telegram-bot-api/telegram-bot-api" "sort" - "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" "strconv" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping" ) func (p *Pokedexer) pokememesListingMessage(update *tgbotapi.Update, page int, pokememesArray map[int]*datamapping.PokememeFull) string { diff --git a/lib/pokedexer/responders.go b/lib/pokedexer/responders.go index 01a8970..9deb059 100644 --- a/lib/pokedexer/responders.go +++ b/lib/pokedexer/responders.go @@ -4,10 +4,11 @@ package pokedexer import ( - "github.com/go-telegram-bot-api/telegram-bot-api" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // AdvicePokememesList shows list for catching diff --git a/lib/reminder/reminder.go b/lib/reminder/reminder.go index da4c182..1b4234b 100644 --- a/lib/reminder/reminder.go +++ b/lib/reminder/reminder.go @@ -4,9 +4,10 @@ package reminder import ( + "strconv" + "github.com/go-telegram-bot-api/telegram-bot-api" "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" - "strconv" ) func (r *Reminder) getRemindersForUser(playerRaw *dbmapping.Player) ([]dbmapping.Alarm, bool) { diff --git a/lib/reminder/sender.go b/lib/reminder/sender.go index e07a084..bf852cd 100644 --- a/lib/reminder/sender.go +++ b/lib/reminder/sender.go @@ -4,9 +4,10 @@ package reminder import ( + "time" + "github.com/go-telegram-bot-api/telegram-bot-api" "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" - "time" ) // SendReminders sends reminders for users about coming league tournament diff --git a/lib/reminder/updaters.go b/lib/reminder/updaters.go index c4335bc..8cdd30a 100644 --- a/lib/reminder/updaters.go +++ b/lib/reminder/updaters.go @@ -4,11 +4,12 @@ package reminder import ( - "github.com/go-telegram-bot-api/telegram-bot-api" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" "time" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // CreateAlarmSetting creates alarm setting for user diff --git a/lib/router/private_request.go b/lib/router/private_request.go index 3d11325..30d5789 100644 --- a/lib/router/private_request.go +++ b/lib/router/private_request.go @@ -4,10 +4,11 @@ package router import ( - "github.com/go-telegram-bot-api/telegram-bot-api" "regexp" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) func (r *Router) routePrivateRequest(update tgbotapi.Update, playerRaw *dbmapping.Player, chatRaw *dbmapping.Chat) string { diff --git a/lib/squader/responders.go b/lib/squader/responders.go index ca1cb04..24f38b0 100644 --- a/lib/squader/responders.go +++ b/lib/squader/responders.go @@ -4,10 +4,11 @@ package squader import ( - "github.com/go-telegram-bot-api/telegram-bot-api" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // SquadsList lists all squads diff --git a/lib/squader/squader.go b/lib/squader/squader.go index ee753eb..c391191 100644 --- a/lib/squader/squader.go +++ b/lib/squader/squader.go @@ -4,12 +4,13 @@ package squader import ( - "github.com/go-telegram-bot-api/telegram-bot-api" "regexp" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" "time" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) func (s *Squader) isUserAnyCommander(playerID int) bool { diff --git a/lib/statistics/squads.go b/lib/statistics/squads.go index dd21fde..e01a1a0 100644 --- a/lib/statistics/squads.go +++ b/lib/statistics/squads.go @@ -4,8 +4,9 @@ package statistics import ( - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" + + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // SquadStatictics generates statistics message snippet. Public due to usage in chats list diff --git a/lib/statistics/statisticsinterface/statisticinterface.go b/lib/statistics/statisticsinterface/statisticinterface.go index f8b065b..a37112a 100644 --- a/lib/statistics/statisticsinterface/statisticinterface.go +++ b/lib/statistics/statisticsinterface/statisticinterface.go @@ -4,8 +4,8 @@ package statisticsinterface import ( - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // StatisticsInterface implements Statistics for importing via appcontext. diff --git a/lib/statistics/top.go b/lib/statistics/top.go index 0348696..39a5894 100644 --- a/lib/statistics/top.go +++ b/lib/statistics/top.go @@ -4,10 +4,11 @@ package statistics import ( - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" - "github.com/go-telegram-bot-api/telegram-bot-api" "sort" "strconv" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) func (s *Statistics) renderPosition(profilesRaw *[]*dbmapping.PlayerProfile, playerRaw *dbmapping.Player) string { @@ -110,11 +111,11 @@ func (s *Statistics) TopList(update *tgbotapi.Update, playerRaw *dbmapping.Playe message += "\n*Топ-5 по опыту*\n" sort.Slice(profiles, func(i, j int) bool { - return profiles[i].Profile.FullExp() > profiles[j].Profile.FullExp() + return profiles[i].Profile.Exp > profiles[j].Profile.Exp }) for i := 0; i < topLimit; i++ { - message += "*" + strconv.Itoa(i+1) + "*: " + c.Users.FormatUsername(profiles[i].Profile.Nickname) + " (" + strconv.Itoa(profiles[i].Profile.FullExp()) + " очков)\n" + message += "*" + strconv.Itoa(i+1) + "*: " + c.Users.FormatUsername(profiles[i].Profile.Nickname) + " (" + strconv.Itoa(profiles[i].Profile.Exp) + " очков)\n" } message += s.renderPosition(&profiles, playerRaw) diff --git a/lib/users/getters.go b/lib/users/getters.go index 4d2fcd9..cd1193e 100644 --- a/lib/users/getters.go +++ b/lib/users/getters.go @@ -4,8 +4,8 @@ package users import ( - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // GetPrettyName returns "pretty" name of user (first_name + last name or username) diff --git a/lib/users/parsers.go b/lib/users/parsers.go index ed2b6ad..1e56922 100644 --- a/lib/users/parsers.go +++ b/lib/users/parsers.go @@ -1,5 +1,5 @@ // i2_bot – Instinct PokememBro Bot -// Copyright (c) 2017 Vladimir "fat0troll" Hodakov +// Copyright (c) 2017-2018 Vladimir "fat0troll" Hodakov package users @@ -64,8 +64,8 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe wealthInt := 0 pokememesWealth := "" pokememesWealthInt := 0 - crystalls := "" - crystallsInt := 0 + crystals := "" + crystalsInt := 0 weapon := "" pokememes := make(map[string]string) powerInt := 0 @@ -145,8 +145,8 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe } wealth = wealthArray[0] wealthInt = c.Statistics.GetPoints(wealth) - crystalls = wealthArray[1] - crystallsInt = c.Statistics.GetPoints(crystalls) + crystals = wealthArray[1] + crystalsInt = c.Statistics.GetPoints(crystals) } if strings.HasPrefix(currentString, "🔫") { @@ -208,8 +208,8 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe c.Log.Debugln(pokeballsInt) c.Log.Debug("Wealth: " + wealth) c.Log.Debugln(wealthInt) - c.Log.Debug("Crystalls: " + crystalls) - c.Log.Debugln(crystallsInt) + c.Log.Debug("crystals: " + crystals) + c.Log.Debugln(crystalsInt) c.Log.Debug("Weapon: " + weapon) if len(pokememes) > 0 { c.Log.Debug("Hand cost: " + pokememesWealth) @@ -265,7 +265,7 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe } else { profileRaw.WeaponID = 0 } - profileRaw.Crystalls = crystallsInt + profileRaw.Crystals = crystalsInt profileRaw.CreatedAt = time.Now().UTC() newProfileID, err := c.DataCache.AddProfile(&profileRaw) diff --git a/lib/users/responders.go b/lib/users/responders.go index 84b32fa..2a26ed7 100644 --- a/lib/users/responders.go +++ b/lib/users/responders.go @@ -4,10 +4,11 @@ package users import ( - "github.com/go-telegram-bot-api/telegram-bot-api" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // FormatUsername formats Telegram username for posting @@ -97,19 +98,6 @@ func (u *Users) ForeignProfileMessage(update *tgbotapi.Update) string { return u.ProfileMessage(update, playerRaw) } -// ProfileAddEffectsMessage shows when user tries to post profile with effects enabled -func (u *Users) ProfileAddEffectsMessage(update *tgbotapi.Update) string { - message := "*Наркоман, штоле?*\n\n" - message += "Бот не принимает профили во время активированных эффектов. Закончи свои дела и принеси чистый профиль через полчаса." - - msg := tgbotapi.NewMessage(update.Message.Chat.ID, message) - msg.ParseMode = "Markdown" - - c.Bot.Send(msg) - - return "fail" -} - // ProfileMessage shows current player's profile func (u *Users) ProfileMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) string { profileRaw, err := c.DataCache.GetProfileByPlayerID(playerRaw.ID) @@ -158,7 +146,7 @@ func (u *Users) ProfileMessage(update *tgbotapi.Update, playerRaw *dbmapping.Pla message += " | 🎓 " + strconv.Itoa(profileRaw.Exp) + "/" + strconv.Itoa(level.MaxExp) message += " | 🥚 " + strconv.Itoa(profileRaw.EggExp) + "/" + strconv.Itoa(level.MaxEgg) message += "\n💲" + c.Statistics.GetPrintablePoints(profileRaw.Wealth) - message += " |💎" + strconv.Itoa(profileRaw.Crystalls) + message += " |💎" + strconv.Itoa(profileRaw.Crystals) message += " |⭕" + strconv.Itoa(profileRaw.Pokeballs) if weapon != nil { message += "\n⚔Атака: " + c.Statistics.GetPrintablePoints(weapon.Power) + " + " + c.Statistics.GetPrintablePoints(attackPokememes) + "\n" diff --git a/lib/users/users.go b/lib/users/users.go index bf24b4e..c12465d 100644 --- a/lib/users/users.go +++ b/lib/users/users.go @@ -4,12 +4,13 @@ package users import ( - "github.com/go-telegram-bot-api/telegram-bot-api" "sort" - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "strconv" "strings" "time" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // Internal functions for Users package diff --git a/lib/users/usersinterface/usersinterface.go b/lib/users/usersinterface/usersinterface.go index 5c0b591..666d3c0 100644 --- a/lib/users/usersinterface/usersinterface.go +++ b/lib/users/usersinterface/usersinterface.go @@ -4,8 +4,8 @@ package usersinterface import ( - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // UsersInterface implements Users for importing via appcontex @@ -22,7 +22,6 @@ type UsersInterface interface { FindByTopAttack(update *tgbotapi.Update) string ForeignProfileMessage(update *tgbotapi.Update) string FormatUsername(userName string) string - ProfileAddEffectsMessage(update *tgbotapi.Update) string ProfileMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) string UsersList(update *tgbotapi.Update) string } diff --git a/lib/welcomer/notifications.go b/lib/welcomer/notifications.go index ea82bd2..f550ec4 100644 --- a/lib/welcomer/notifications.go +++ b/lib/welcomer/notifications.go @@ -4,8 +4,9 @@ package welcomer import ( - "github.com/go-telegram-bot-api/telegram-bot-api" "strconv" + + "github.com/go-telegram-bot-api/telegram-bot-api" ) func (w *Welcomer) alertUserWithoutProfile(update *tgbotapi.Update, newUser *tgbotapi.User) string { diff --git a/lib/welcomer/responders.go b/lib/welcomer/responders.go index 60b9cf6..f6a4348 100644 --- a/lib/welcomer/responders.go +++ b/lib/welcomer/responders.go @@ -4,9 +4,10 @@ package welcomer import ( - "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" - "github.com/go-telegram-bot-api/telegram-bot-api" "strconv" + + "github.com/go-telegram-bot-api/telegram-bot-api" + "source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping" ) // PrivateWelcomeMessageUnauthorized tell new user what to do. diff --git a/lib/welcomer/welcomer.go b/lib/welcomer/welcomer.go index cc5bef7..6884fbc 100644 --- a/lib/welcomer/welcomer.go +++ b/lib/welcomer/welcomer.go @@ -4,8 +4,9 @@ package welcomer import ( - "github.com/go-telegram-bot-api/telegram-bot-api" "time" + + "github.com/go-telegram-bot-api/telegram-bot-api" ) func (w *Welcomer) groupWelcomeUser(update *tgbotapi.Update, newUser *tgbotapi.User) string {