package commands import ( "fmt" "git.dragon-labs.de/alphyron/group_helper/cli" "git.dragon-labs.de/alphyron/group_helper/models" tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api" ) type chatInfoCommand struct { } func NewChatInfoCommand() cli.Command { return &chatInfoCommand{} } func (i chatInfoCommand) GetUsage() string { return "/chat\\_info" } func (i chatInfoCommand) GetCommand() string { return "/chat_info" } func (i chatInfoCommand) GetDescription() string { return "Return just some simple Telegram Information about this group" } func (i chatInfoCommand) ExecuteCommand(bot *tgbotapi.BotAPI, update *tgbotapi.Update, group *models.Group) (bool, error) { infoMessage := fmt.Sprintf("General Information to this Group\n"+ "Group ID: %d\n"+ "Group Name: %s\n"+ "Description: %s\n"+ "Group Type: %s\n"+ "===============================\n", update.Message.Chat.ID, update.Message.Chat.Title, update.Message.Chat.Description, update.Message.Chat.Type) msg := tgbotapi.NewMessage(update.Message.Chat.ID, infoMessage) msg.ParseMode = "Markdown" _, err := bot.Send(msg) return err == nil, nil } func (i chatInfoCommand) AllowChatType(*tgbotapi.Chat) bool { return true } func (i chatInfoCommand) AllowMember(*tgbotapi.ChatMember) bool { return i.AllowEveryMember() } func (i chatInfoCommand) AllowEveryMember() bool { return true }