hdkv
/
i2_bot
Archived
1
Fork 0

PokememBroInstinkt chat bans fix

master
Vladimir Hodakov 2017-12-23 21:08:57 +04:00
parent 24e4904807
commit f6d8d064ed
2 changed files with 7 additions and 1 deletions

View File

@ -12,8 +12,14 @@ import (
func (ct *Chatter) userPrivilegesCheck(update *tgbotapi.Update, user *tgbotapi.User) bool {
// There are two special chats, pointed by config, where any member of league may be
defaultChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.DefaultID, 10, 64)
bastionChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.BastionID, 10, 64)
academyChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.AcademyID, 10, 64)
if update.Message.Chat.ID == defaultChatID {
return true
}
// There are special users, which will bypass these checks
specialUsers := []string{"gantz_yaka", "agentpb", "pbhelp"}

View File

@ -50,7 +50,7 @@ func (u *Users) getUsersWithProfiles() ([]dbmapping.PlayerProfile, bool) {
func (u *Users) findUserByName(pattern string) ([]dbmapping.ProfileWithAddons, bool) {
selectedUsers := []dbmapping.ProfileWithAddons{}
err := c.Db.Select(&selectedUsers, c.Db.Rebind("SELECT * FROM (SELECT p.*, l.symbol AS league_symbol, l.id AS league_id, pl.telegram_id FROM players pl, profiles p, leagues l WHERE p.player_id = pl.id AND l.id = pl.league_id AND (p.nickname LIKE ? OR p.telegram_nickname LIKE ?) ORDER BY p.id desc LIMIT 100000) AS find_users_table GROUP BY player_id"), "%"+pattern+"%", "%"+pattern+"%")
err := c.Db.Select(&selectedUsers, c.Db.Rebind("SELECT * FROM (SELECT p.*, l.symbol AS league_symbol, l.id AS league_id, pl.telegram_id FROM players pl, profiles p, leagues l WHERE p.player_id = pl.id AND l.id = pl.league_id AND (p.nickname LIKE ? OR p.telegram_nickname LIKE ?) ORDER BY p.id DESC LIMIT 100000) AS find_users_table GROUP BY player_id"), "%"+pattern+"%", "%"+pattern+"%")
if err != nil {
c.Log.Error(err.Error())
return selectedUsers, false