Visual fixes in broadcast messages, some fixes in squader
He protec, but he also attac!
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package users
|
||||
|
||||
import (
|
||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||
"lab.pztrn.name/fat0troll/i2_bot/lib/dbmapping"
|
||||
"time"
|
||||
)
|
||||
@@ -59,6 +60,19 @@ func (u *Users) GetOrCreatePlayer(telegramID int) (dbmapping.Player, bool) {
|
||||
return playerRaw, true
|
||||
}
|
||||
|
||||
// GetPrettyName returns "pretty" name of user (first_name + last name or username)
|
||||
func (u *Users) GetPrettyName(user *tgbotapi.User) string {
|
||||
userName := user.FirstName
|
||||
if user.LastName != "" {
|
||||
userName += " " + user.LastName
|
||||
}
|
||||
|
||||
if user.UserName != "" {
|
||||
userName += " (@" + user.UserName + ")"
|
||||
}
|
||||
return c.Users.FormatUsername(userName)
|
||||
}
|
||||
|
||||
// PlayerBetterThan return true, if profile is more or equal powerful than
|
||||
// provided power level
|
||||
func (u *Users) PlayerBetterThan(playerRaw *dbmapping.Player, powerLevel string) bool {
|
||||
|
@@ -14,6 +14,7 @@ type UsersInterface interface {
|
||||
|
||||
ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Player) string
|
||||
|
||||
GetPrettyName(user *tgbotapi.User) string
|
||||
GetProfile(playerID int) (dbmapping.Profile, bool)
|
||||
GetOrCreatePlayer(telegramID int) (dbmapping.Player, bool)
|
||||
GetPlayerByID(playerID int) (dbmapping.Player, bool)
|
||||
|
Reference in New Issue
Block a user