Format imports with goimport
This commit is contained in:
parent
ef9cf07abc
commit
86afa52a56
@ -4,8 +4,9 @@
|
|||||||
package broadcaster
|
package broadcaster
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *Broadcaster) createBroadcastMessage(playerRaw *dbmapping.Player, messageBody string, broadcastType string) (dbmapping.Broadcast, bool) {
|
func (b *Broadcaster) createBroadcastMessage(playerRaw *dbmapping.Player, messageBody string, broadcastType string) (dbmapping.Broadcast, bool) {
|
||||||
|
@ -5,10 +5,10 @@ package connections
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bitbucket.org/pztrn/mogrus"
|
"bitbucket.org/pztrn/mogrus"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/config"
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BotInit initializes connection to Telegram
|
// BotInit initializes connection to Telegram
|
||||||
|
@ -5,10 +5,11 @@ package datacache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dc *DataCache) initChats() {
|
func (dc *DataCache) initChats() {
|
||||||
|
@ -5,10 +5,11 @@ package datacache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dc *DataCache) initElements() {
|
func (dc *DataCache) initElements() {
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
package datacache
|
package datacache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/appcontext"
|
"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/datacache/datacacheinterface"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
"sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -5,10 +5,11 @@ package datacache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dc *DataCache) initLeagues() {
|
func (dc *DataCache) initLeagues() {
|
||||||
|
@ -5,10 +5,11 @@ package datacache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dc *DataCache) initLevels() {
|
func (dc *DataCache) initLevels() {
|
||||||
|
@ -5,10 +5,11 @@ package datacache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dc *DataCache) initLocations() {
|
func (dc *DataCache) initLocations() {
|
||||||
|
@ -5,9 +5,10 @@ package datacache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dc *DataCache) initPlayers() {
|
func (dc *DataCache) initPlayers() {
|
||||||
|
@ -5,11 +5,12 @@ package datacache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dc *DataCache) initPokememes() {
|
func (dc *DataCache) initPokememes() {
|
||||||
|
@ -5,8 +5,9 @@ package datacache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dc *DataCache) initProfiles() {
|
func (dc *DataCache) initProfiles() {
|
||||||
|
@ -5,8 +5,9 @@ package datacache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dc *DataCache) initSquads() {
|
func (dc *DataCache) initSquads() {
|
||||||
|
@ -5,11 +5,12 @@ package datacache
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
"source.wtfteam.pro/i2_bot/i2_bot/static"
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (dc *DataCache) initWeapons() {
|
func (dc *DataCache) initWeapons() {
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
package dbmapping
|
package dbmapping
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-sql-driver/mysql"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-sql-driver/mysql"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Order is a struct, which represents `orders` table item in databse.
|
// Order is a struct, which represents `orders` table item in databse.
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
package dbmapping
|
package dbmapping
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Player is a struct, which represents `players` table item in databse.
|
// Player is a struct, which represents `players` table item in databse.
|
||||||
|
@ -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"`
|
|
||||||
}
|
|
@ -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"`
|
|
||||||
}
|
|
@ -4,7 +4,6 @@
|
|||||||
package dbmapping
|
package dbmapping
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,18 +21,12 @@ type Profile struct {
|
|||||||
EggExp int `db:"egg_exp"`
|
EggExp int `db:"egg_exp"`
|
||||||
Power int `db:"power"`
|
Power int `db:"power"`
|
||||||
WeaponID int `db:"weapon_id"`
|
WeaponID int `db:"weapon_id"`
|
||||||
Crystalls int `db:"crystalls"`
|
Crystals int `db:"crystalls"`
|
||||||
CreatedAt time.Time `db:"created_at"`
|
CreatedAt time.Time `db:"created_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FullExp returns exp points in summary, gained after registration
|
// ProfileWithPokememes is a struct, which represents full profile with current hand
|
||||||
func (p *Profile) FullExp() int {
|
type ProfileWithPokememes struct {
|
||||||
fullExp := 0.00
|
Profile Profile
|
||||||
|
Pokememes ProfilePokememe
|
||||||
for i := 1; i < p.LevelID+1; i++ {
|
|
||||||
fullExp = fullExp + (100 * math.Pow(2.0, float64(i)))
|
|
||||||
}
|
|
||||||
|
|
||||||
fullExp += float64(p.Exp)
|
|
||||||
return int(fullExp)
|
|
||||||
}
|
}
|
||||||
|
@ -4,18 +4,19 @@
|
|||||||
package forwarder
|
package forwarder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ProcessForward process forwards for single-user chats
|
// ProcessForward process forwards for single-user chats
|
||||||
func (f *Forwarder) ProcessForward(update *tgbotapi.Update, playerRaw *dbmapping.Player) string {
|
func (f *Forwarder) ProcessForward(update *tgbotapi.Update, playerRaw *dbmapping.Player) string {
|
||||||
text := update.Message.Text
|
text := update.Message.Text
|
||||||
|
|
||||||
// Forwards
|
// Forwards
|
||||||
var pokememeMsg = regexp.MustCompile(`Dex(.+)\nGrade(.+)\nName(.+)`)
|
var pokememeMsg = regexp.MustCompile(`Dex(.+)\nGrade(.+)\nName(.+)`)
|
||||||
var profileMsg = regexp.MustCompile(`(Онлайн: )(\d+)(| Турнир: )(.+)\n(.+)\n(.+)\n(👤Уровень)(.+)\n`)
|
var profileMsg = regexp.MustCompile(`id(\s)(\d+)\n(Team)(\s)([А-Я]+)\nName(\s)(.*)\nLvl(\s)(\d+)`)
|
||||||
var profileWithEffectsMsg = regexp.MustCompile(`(Онлайн: )(\d+)(| Турнир: )(.+)\n(.+)\n(.+)\n(.+)\n(👤Уровень)(.+)\n`)
|
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case pokememeMsg.MatchString(text):
|
case pokememeMsg.MatchString(text):
|
||||||
@ -28,8 +29,6 @@ func (f *Forwarder) ProcessForward(update *tgbotapi.Update, playerRaw *dbmapping
|
|||||||
case profileMsg.MatchString(text):
|
case profileMsg.MatchString(text):
|
||||||
c.Log.Debug("Profile posted!")
|
c.Log.Debug("Profile posted!")
|
||||||
return c.Users.ParseProfile(update, playerRaw)
|
return c.Users.ParseProfile(update, playerRaw)
|
||||||
case profileWithEffectsMsg.MatchString(text):
|
|
||||||
return c.Users.ProfileAddEffectsMessage(update)
|
|
||||||
default:
|
default:
|
||||||
c.Log.Debug(text)
|
c.Log.Debug(text)
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
package orders
|
package orders
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Internal functions
|
// Internal functions
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
package orders
|
package orders
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListAllOrders returns to user all orders in database
|
// ListAllOrders returns to user all orders in database
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
package pinner
|
package pinner
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"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 {
|
func (p *Pinner) execMassMessagePin(update *tgbotapi.Update, groupChats []dbmapping.Chat) string {
|
||||||
|
@ -5,9 +5,10 @@ package pokedexer
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (p *Pokedexer) getAdvicePokememes(playerID int, adviceType string) ([]*datamapping.PokememeFull, bool) {
|
func (p *Pokedexer) getAdvicePokememes(playerID int, adviceType string) ([]*datamapping.PokememeFull, bool) {
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
package pokedexer
|
package pokedexer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"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
|
// ParsePokememe parses pokememe, forwarded from PokememeBroBot, to database
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
package pokedexer
|
package pokedexer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"sort"
|
"sort"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/datamapping"
|
|
||||||
"strconv"
|
"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 {
|
func (p *Pokedexer) pokememesListingMessage(update *tgbotapi.Update, page int, pokememesArray map[int]*datamapping.PokememeFull) string {
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
package pokedexer
|
package pokedexer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AdvicePokememesList shows list for catching
|
// AdvicePokememesList shows list for catching
|
||||||
|
@ -4,9 +4,10 @@
|
|||||||
package reminder
|
package reminder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (r *Reminder) getRemindersForUser(playerRaw *dbmapping.Player) ([]dbmapping.Alarm, bool) {
|
func (r *Reminder) getRemindersForUser(playerRaw *dbmapping.Player) ([]dbmapping.Alarm, bool) {
|
||||||
|
@ -4,9 +4,10 @@
|
|||||||
package reminder
|
package reminder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SendReminders sends reminders for users about coming league tournament
|
// SendReminders sends reminders for users about coming league tournament
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
package reminder
|
package reminder
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"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
|
// CreateAlarmSetting creates alarm setting for user
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
package router
|
package router
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"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 {
|
func (r *Router) routePrivateRequest(update tgbotapi.Update, playerRaw *dbmapping.Player, chatRaw *dbmapping.Chat) string {
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
package squader
|
package squader
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SquadsList lists all squads
|
// SquadsList lists all squads
|
||||||
|
@ -4,12 +4,13 @@
|
|||||||
package squader
|
package squader
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"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 {
|
func (s *Squader) isUserAnyCommander(playerID int) bool {
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
package statistics
|
package statistics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SquadStatictics generates statistics message snippet. Public due to usage in chats list
|
// SquadStatictics generates statistics message snippet. Public due to usage in chats list
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
package statisticsinterface
|
package statisticsinterface
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
"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.
|
// StatisticsInterface implements Statistics for importing via appcontext.
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
package statistics
|
package statistics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"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 {
|
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"
|
message += "\n*Топ-5 по опыту*\n"
|
||||||
|
|
||||||
sort.Slice(profiles, func(i, j int) bool {
|
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++ {
|
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)
|
message += s.renderPosition(&profiles, playerRaw)
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
package users
|
package users
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
"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)
|
// GetPrettyName returns "pretty" name of user (first_name + last name or username)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// i2_bot – Instinct PokememBro Bot
|
// i2_bot – Instinct PokememBro Bot
|
||||||
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
|
// Copyright (c) 2017-2018 Vladimir "fat0troll" Hodakov
|
||||||
|
|
||||||
package users
|
package users
|
||||||
|
|
||||||
@ -64,8 +64,8 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe
|
|||||||
wealthInt := 0
|
wealthInt := 0
|
||||||
pokememesWealth := ""
|
pokememesWealth := ""
|
||||||
pokememesWealthInt := 0
|
pokememesWealthInt := 0
|
||||||
crystalls := ""
|
crystals := ""
|
||||||
crystallsInt := 0
|
crystalsInt := 0
|
||||||
weapon := ""
|
weapon := ""
|
||||||
pokememes := make(map[string]string)
|
pokememes := make(map[string]string)
|
||||||
powerInt := 0
|
powerInt := 0
|
||||||
@ -145,8 +145,8 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe
|
|||||||
}
|
}
|
||||||
wealth = wealthArray[0]
|
wealth = wealthArray[0]
|
||||||
wealthInt = c.Statistics.GetPoints(wealth)
|
wealthInt = c.Statistics.GetPoints(wealth)
|
||||||
crystalls = wealthArray[1]
|
crystals = wealthArray[1]
|
||||||
crystallsInt = c.Statistics.GetPoints(crystalls)
|
crystalsInt = c.Statistics.GetPoints(crystals)
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(currentString, "🔫") {
|
if strings.HasPrefix(currentString, "🔫") {
|
||||||
@ -208,8 +208,8 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe
|
|||||||
c.Log.Debugln(pokeballsInt)
|
c.Log.Debugln(pokeballsInt)
|
||||||
c.Log.Debug("Wealth: " + wealth)
|
c.Log.Debug("Wealth: " + wealth)
|
||||||
c.Log.Debugln(wealthInt)
|
c.Log.Debugln(wealthInt)
|
||||||
c.Log.Debug("Crystalls: " + crystalls)
|
c.Log.Debug("crystals: " + crystals)
|
||||||
c.Log.Debugln(crystallsInt)
|
c.Log.Debugln(crystalsInt)
|
||||||
c.Log.Debug("Weapon: " + weapon)
|
c.Log.Debug("Weapon: " + weapon)
|
||||||
if len(pokememes) > 0 {
|
if len(pokememes) > 0 {
|
||||||
c.Log.Debug("Hand cost: " + pokememesWealth)
|
c.Log.Debug("Hand cost: " + pokememesWealth)
|
||||||
@ -265,7 +265,7 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe
|
|||||||
} else {
|
} else {
|
||||||
profileRaw.WeaponID = 0
|
profileRaw.WeaponID = 0
|
||||||
}
|
}
|
||||||
profileRaw.Crystalls = crystallsInt
|
profileRaw.Crystals = crystalsInt
|
||||||
profileRaw.CreatedAt = time.Now().UTC()
|
profileRaw.CreatedAt = time.Now().UTC()
|
||||||
|
|
||||||
newProfileID, err := c.DataCache.AddProfile(&profileRaw)
|
newProfileID, err := c.DataCache.AddProfile(&profileRaw)
|
||||||
|
@ -4,10 +4,11 @@
|
|||||||
package users
|
package users
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"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
|
// FormatUsername formats Telegram username for posting
|
||||||
@ -97,19 +98,6 @@ func (u *Users) ForeignProfileMessage(update *tgbotapi.Update) string {
|
|||||||
return u.ProfileMessage(update, playerRaw)
|
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
|
// ProfileMessage shows current player's profile
|
||||||
func (u *Users) ProfileMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) string {
|
func (u *Users) ProfileMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) string {
|
||||||
profileRaw, err := c.DataCache.GetProfileByPlayerID(playerRaw.ID)
|
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.Exp) + "/" + strconv.Itoa(level.MaxExp)
|
||||||
message += " | 🥚 " + strconv.Itoa(profileRaw.EggExp) + "/" + strconv.Itoa(level.MaxEgg)
|
message += " | 🥚 " + strconv.Itoa(profileRaw.EggExp) + "/" + strconv.Itoa(level.MaxEgg)
|
||||||
message += "\n💲" + c.Statistics.GetPrintablePoints(profileRaw.Wealth)
|
message += "\n💲" + c.Statistics.GetPrintablePoints(profileRaw.Wealth)
|
||||||
message += " |💎" + strconv.Itoa(profileRaw.Crystalls)
|
message += " |💎" + strconv.Itoa(profileRaw.Crystals)
|
||||||
message += " |⭕" + strconv.Itoa(profileRaw.Pokeballs)
|
message += " |⭕" + strconv.Itoa(profileRaw.Pokeballs)
|
||||||
if weapon != nil {
|
if weapon != nil {
|
||||||
message += "\n⚔Атака: " + c.Statistics.GetPrintablePoints(weapon.Power) + " + " + c.Statistics.GetPrintablePoints(attackPokememes) + "\n"
|
message += "\n⚔Атака: " + c.Statistics.GetPrintablePoints(weapon.Power) + " + " + c.Statistics.GetPrintablePoints(attackPokememes) + "\n"
|
||||||
|
@ -4,12 +4,13 @@
|
|||||||
package users
|
package users
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"sort"
|
"sort"
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
|
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Internal functions for Users package
|
// Internal functions for Users package
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
package usersinterface
|
package usersinterface
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
"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
|
// UsersInterface implements Users for importing via appcontex
|
||||||
@ -22,7 +22,6 @@ type UsersInterface interface {
|
|||||||
FindByTopAttack(update *tgbotapi.Update) string
|
FindByTopAttack(update *tgbotapi.Update) string
|
||||||
ForeignProfileMessage(update *tgbotapi.Update) string
|
ForeignProfileMessage(update *tgbotapi.Update) string
|
||||||
FormatUsername(userName string) string
|
FormatUsername(userName string) string
|
||||||
ProfileAddEffectsMessage(update *tgbotapi.Update) string
|
|
||||||
ProfileMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) string
|
ProfileMessage(update *tgbotapi.Update, playerRaw *dbmapping.Player) string
|
||||||
UsersList(update *tgbotapi.Update) string
|
UsersList(update *tgbotapi.Update) string
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
package welcomer
|
package welcomer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (w *Welcomer) alertUserWithoutProfile(update *tgbotapi.Update, newUser *tgbotapi.User) string {
|
func (w *Welcomer) alertUserWithoutProfile(update *tgbotapi.Update, newUser *tgbotapi.User) string {
|
||||||
|
@ -4,9 +4,10 @@
|
|||||||
package welcomer
|
package welcomer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"source.wtfteam.pro/i2_bot/i2_bot/lib/dbmapping"
|
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"strconv"
|
"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.
|
// PrivateWelcomeMessageUnauthorized tell new user what to do.
|
||||||
|
@ -4,8 +4,9 @@
|
|||||||
package welcomer
|
package welcomer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (w *Welcomer) groupWelcomeUser(update *tgbotapi.Update, newUser *tgbotapi.User) string {
|
func (w *Welcomer) groupWelcomeUser(update *tgbotapi.Update, newUser *tgbotapi.User) string {
|
||||||
|
Reference in New Issue
Block a user