Archived
1

Format imports with goimport

This commit is contained in:
2018-05-02 07:25:39 +04:00
parent ef9cf07abc
commit 86afa52a56
43 changed files with 108 additions and 128 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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"

View File

@@ -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

View File

@@ -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
}