Archived
1
This repository has been archived on 2022-11-04. You can view files and clone it, but cannot push or open issues or pull requests.
i2_bot/lib/chatter/responders.go
Vladimir Hodakov f67e652ae4 Add games chat
Games chat used to divide talks in Bastion from @gamee games and so on.
2018-04-04 21:33:30 +04:00

61 lines
2.0 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017-2018 Vladimir "fat0troll" Hodakov
package chatter
import (
"strconv"
"github.com/go-telegram-bot-api/telegram-bot-api"
)
// GroupsList lists all chats where bot exist
func (ct *Chatter) GroupsList(update *tgbotapi.Update) string {
groupChats := c.DataCache.GetAllGroupChats()
academyChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.AcademyID, 10, 64)
bastionChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.BastionID, 10, 64)
defaultChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.DefaultID, 10, 64)
hqChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.HeadquartersID, 10, 64)
gamesChatID, _ := strconv.ParseInt(c.Cfg.SpecialChats.GamesID, 10, 64)
message := "*Бот состоит в следующих групповых чатах:*\n"
for i := range groupChats {
message += "---\n"
message += "\\[#" + strconv.Itoa(groupChats[i].ID) + "] _" + c.Users.FormatUsername(groupChats[i].Name) + "_\n"
message += "Telegram ID: " + strconv.FormatInt(groupChats[i].TelegramID, 10) + "\n"
squad, squadExistErr := c.DataCache.GetSquadByChatID(groupChats[i].ID)
if squadExistErr == nil {
message += "Статистика отряда:\n"
message += c.Statistics.SquadStatictics(squad.ID)
} else {
if groupChats[i].TelegramID == academyChatID {
message += "Является академией лиги\n"
}
if groupChats[i].TelegramID == bastionChatID {
message += "Является бастионом лиги\n"
}
if groupChats[i].TelegramID == defaultChatID {
message += "Является чатом по умолчанию лиги\n"
}
if groupChats[i].TelegramID == hqChatID {
message += "Является чатом совета лиги\n"
}
if groupChats[i].TelegramID == gamesChatID {
message += "Является игровым чатом\n"
}
}
}
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
msg.ParseMode = "Markdown"
c.Bot.Send(msg)
return "ok"
}