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/talkers/chats.go

40 lines
1.1 KiB
Go
Raw 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 Vladimir "fat0troll" Hodakov
package talkers
import (
// stdlib
"strconv"
// 3rd party
"github.com/go-telegram-bot-api/telegram-bot-api"
)
// GroupsList lists all known pokememes
func (t *Talkers) GroupsList(update tgbotapi.Update) string {
groupChats, ok := c.Getters.GetAllGroupChatsWithSquads()
if !ok {
return "fail"
}
message := "*Бот состоит в следующих групповых чатах:*\n"
for i := range groupChats {
message += "---\n"
message += "[#" + strconv.Itoa(groupChats[i].Chat.ID) + "] _" + groupChats[i].Chat.Name + "_\n"
message += "Telegram ID: " + strconv.FormatInt(groupChats[i].Chat.TelegramID, 10) + "\n"
if groupChats[i].IsSquad {
message += "Является отрядом <статистика>\n"
} else {
message += "Не является отрядом. Сделать отрядом: /make\\_squad" + strconv.Itoa(groupChats[i].Chat.ID) + "\n"
}
}
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
msg.ParseMode = "Markdown"
c.Bot.Send(msg)
return "ok"
}