feat: announce command list

This commit is contained in:
Yiyang Kang 2022-11-23 04:33:23 +08:00
parent 37dffe56ce
commit 440d36b291
Signed by: kkyy
GPG key ID: 80FD317ECAF06CC3
2 changed files with 22 additions and 2 deletions

14
main.go
View file

@ -6,6 +6,7 @@ import (
"syscall"
"go.uber.org/zap"
tele "gopkg.in/telebot.v3"
"git.gensokyo.cafe/kkyy/tgbot_misaka_5882f7/utils"
)
@ -28,6 +29,19 @@ func runBot() {
logger.Fatalw("Failed to initialize bot", "err", err)
}
// Announce commands
if config.TGAnnounceCommands {
logger.Info("Announcing commands...")
if err = bot.SetCommands([]tele.Command{
{Text: "traffic", Description: "Show traffic usage."},
{Text: "dig", Description: "Diggy diggy dig."},
{Text: "year_progress", Description: "Time doesn't wait."},
}); err != nil {
logger.Fatalw("Failed to announce commands", "err", err)
}
}
botFinCh := utils.WaitFor(bot.Start)
logger.Infow("Bot started", "username", bot.Me.Username)