58 lines
1.2 KiB
Go
58 lines
1.2 KiB
Go
|
package commands
|
||
|
|
||
|
import (
|
||
|
"git.dragon-labs.de/alphyron/group_helper/cli"
|
||
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
|
||
|
)
|
||
|
|
||
|
type infoCommand struct {
|
||
|
}
|
||
|
|
||
|
func NewInfoCommand() cli.Command {
|
||
|
return &infoCommand{}
|
||
|
}
|
||
|
|
||
|
func (i infoCommand) GetUsage() string {
|
||
|
return "/info"
|
||
|
}
|
||
|
|
||
|
func (i infoCommand) GetCommand() string {
|
||
|
return "/info"
|
||
|
}
|
||
|
|
||
|
func (i infoCommand) GetDescription() string {
|
||
|
return "Just some Bot information"
|
||
|
}
|
||
|
|
||
|
func (i infoCommand) ExecuteCommand(bot *tgbotapi.BotAPI, update *tgbotapi.Update) (bool, error) {
|
||
|
infoMessage :=
|
||
|
"General Information to this Bot\n" +
|
||
|
"===============================\n" +
|
||
|
"Developer: @Alphyron\n" +
|
||
|
"Version: 2.0.0\n" +
|
||
|
"Git: [Gitea Repository](https://git.dragon-labs.de/alphyron/group_assistant)\n" +
|
||
|
"==============================="
|
||
|
|
||
|
msg := tgbotapi.NewMessage(update.Message.Chat.ID, infoMessage)
|
||
|
msg.ParseMode = "Markdown"
|
||
|
|
||
|
_, err := bot.Send(msg)
|
||
|
|
||
|
if err != nil {
|
||
|
return false, err
|
||
|
}
|
||
|
return true, nil
|
||
|
}
|
||
|
|
||
|
func (i infoCommand) AllowChatType(*tgbotapi.Chat) bool {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
func (i infoCommand) AllowMember(*tgbotapi.ChatMember) bool {
|
||
|
return i.AllowEveryMember()
|
||
|
}
|
||
|
|
||
|
func (i infoCommand) AllowEveryMember() bool {
|
||
|
return true
|
||
|
}
|