PokememBroInstinkt chat bans fix
This commit is contained in:
		| @@ -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"} | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user