Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
feat: auto set bot commands description
Browse files Browse the repository at this point in the history
  • Loading branch information
indes committed Oct 8, 2020
1 parent 51f730f commit 0ba61ba
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,42 @@ func init() {
//Start bot
func Start() {
if config.RunMode != config.TestMode {
makeHandle()
setCommands()
setHandle()
B.Start()
}
}

func makeHandle() {
func setCommands() {
// 设置bot命令提示信息
commands := []tb.Command{
{"start", "开始使用"},
{"sub", "订阅rss源"},
{"list", "当前订阅的rss源"},
{"unsub", "退订rss源"},
{"unsuball", "退订所有rss源"},

{"set", "设置rss订阅"},
{"setfeedtag", "设置rss订阅标签"},
{"setinterval", "设置rss订阅抓取间隔"},

{"export", "导出订阅为opml文件"},
{"import", "从opml文件导入订阅"},

{"check", "检查我的rss订阅状态"},
{"pauseall", "停止抓取订阅更新"},
{"activeall", "开启抓取订阅更新"},

{"help", "使用帮助"},
{"version", "bot版本"},
}

if err := B.SetCommands(commands); err != nil {
log.Errorw("set bot commands failed", "error", err.Error())
}
}

func setHandle() {
B.Handle(&tb.InlineButton{Unique: "set_feed_item_btn"}, setFeedItemBtnCtr)

B.Handle(&tb.InlineButton{Unique: "set_toggle_notice_btn"}, setToggleNoticeBtnCtr)
Expand Down

0 comments on commit 0ba61ba

Please sign in to comment.