Archived
1

Work on squads, some refactoring

Closes #14
See #8
This commit is contained in:
2017-11-19 22:16:11 +04:00
parent 95a9a2146a
commit e4102e9a90
26 changed files with 587 additions and 112 deletions

View File

@@ -27,7 +27,17 @@ func (r *Router) routeGroupRequest(update *tgbotapi.Update, playerRaw *dbmapping
}
// New chat names
if update.Message.NewChatTitle != "" {
_, ok := c.Getters.UpdateChatTitle(chatRaw, update.Message.NewChatTitle)
_, ok := c.Chatter.UpdateChatTitle(chatRaw, update.Message.NewChatTitle)
if ok {
return "ok"
}
return "fail"
}
// New chat IDs (usually on supergroup creation)
if (update.Message.MigrateToChatID != 0) && (update.Message.MigrateFromChatID != 0) {
_, ok := c.Chatter.UpdateChatTelegramID(update)
if ok {
return "ok"
}

View File

@@ -78,10 +78,25 @@ func (r *Router) routePrivateRequest(update *tgbotapi.Update, playerRaw *dbmappi
return "fail"
case update.Message.Command() == "group_chats":
if c.Getters.PlayerBetterThan(playerRaw, "admin") {
c.Talkers.GroupsList(update)
c.Chatter.GroupsList(update)
return "ok"
}
c.Talkers.AnyMessageUnauthorized(update)
return "fail"
case update.Message.Command() == "squads":
if c.Getters.PlayerBetterThan(playerRaw, "admin") {
c.Squader.SquadsList(update)
return "ok"
}
c.Talkers.AnyMessageUnauthorized(update)
return "fail"
case update.Message.Command() == "make_squad":
if c.Getters.PlayerBetterThan(playerRaw, "admin") {
return c.Squader.CreateSquad(update)
}
c.Talkers.AnyMessageUnauthorized(update)
return "fail"
case update.Message.Command() == "pin":

View File

@@ -15,7 +15,7 @@ func (r *Router) RouteRequest(update *tgbotapi.Update) string {
return "fail"
}
chatRaw, ok := c.Getters.GetOrCreateChat(update)
chatRaw, ok := c.Chatter.GetOrCreateChat(update)
if !ok {
return "fail"
}