Archived
1

Some work on ordering. Special user behaviour

See #10
This commit is contained in:
2017-11-26 15:28:55 +04:00
parent 8368a3c60b
commit 53a99b0ff3
20 changed files with 466 additions and 16 deletions

View File

@@ -64,6 +64,8 @@ func (u *Users) GetOrCreatePlayer(telegramID int) (dbmapping.Player, bool) {
func (u *Users) PlayerBetterThan(playerRaw *dbmapping.Player, powerLevel string) bool {
var isBetter = false
switch playerRaw.Status {
case "special":
isBetter = true
case "owner":
isBetter = true
case "admin":

View File

@@ -87,6 +87,14 @@ func (u *Users) ParseProfile(update *tgbotapi.Update, playerRaw *dbmapping.Playe
}
}
}
if strings.HasPrefix(currentString, "id: ") {
realUserID := strings.TrimPrefix(currentString, "id: ")
c.Log.Debug("Profile user ID: " + realUserID)
realUID, _ := strconv.Atoi(realUserID)
if realUID != playerRaw.TelegramID {
return "fail"
}
}
if strings.HasPrefix(currentString, "👤Уровень:") {
levelRx := regexp.MustCompile("\\d+")
levelArray := levelRx.FindAllString(currentString, -1)