Archived
1

New restrictions logic for all chats. Fixed filter for /send_league

This commit is contained in:
2017-12-23 17:03:26 +04:00
parent 2bcb89f74a
commit b7ca6b3c6a
15 changed files with 182 additions and 273 deletions

View File

@@ -37,7 +37,7 @@ func (u *Users) GetPlayerByID(playerID int) (dbmapping.Player, bool) {
// In case, when there is no player with such ID, new player will be created.
func (u *Users) GetOrCreatePlayer(telegramID int) (dbmapping.Player, bool) {
playerRaw := dbmapping.Player{}
err := c.Db.Get(&playerRaw, c.Db.Rebind("SELECT * FROM players WHERE telegram_id=?"), telegramID)
err := c.Db.Get(&playerRaw, c.Db.Rebind("SELECT * FROM players WHERE telegram_id=? ORDER BY created_at desc LIMIT 1"), telegramID)
if err != nil {
c.Log.Error("Message user not found in database.")
c.Log.Error(err.Error())

View File

@@ -12,7 +12,7 @@ import (
// FormatUsername formats Telegram username for posting
func (u *Users) FormatUsername(userName string) string {
return strings.Replace(userName, "_", "\\_", -1)
return strings.Replace(userName, "_", `\_`, -1)
}
// FindByName finds user with such username or nickname