Skip to content

Commit

Permalink
feat: new cmd for view bot version
Browse files Browse the repository at this point in the history
  • Loading branch information
indes committed Apr 26, 2020
1 parent 0284d2a commit b29f417
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion bot/bot.go
Expand Up @@ -84,7 +84,9 @@ func makeHandle() {
B.Handle("/import", importCmdCtr)

B.Handle("/setfeedtag", setFeedTagCmdCtr)


B.Handle("/version", versionCmdCtr)

B.Handle(tb.OnText, textCtr)

B.Handle(tb.OnDocument, docCtr)
Expand Down
5 changes: 5 additions & 0 deletions bot/controller.go
Expand Up @@ -728,9 +728,14 @@ func helpCmdCtr(m *tb.Message) {
/unsuball 取消所有订阅
详细使用方法请看:https://github.com/indes/flowerss-bot
`

_, _ = B.Send(m.Chat, message)
}

func versionCmdCtr(m *tb.Message) {
_, _ = B.Send(m.Chat, config.AppVersionInfo())
}

func importCmdCtr(m *tb.Message) {
message := `请直接发送OPML文件。`
_, _ = B.Send(m.Chat, message)
Expand Down
2 changes: 1 addition & 1 deletion config/autoload.go
Expand Up @@ -99,7 +99,7 @@ func init() {

if *printVersionFlag {
// print version
fmt.Printf("version %v, commit %v, built at %v", version, commit, date)
fmt.Printf(AppVersionInfo())
os.Exit(0)
}

Expand Down
6 changes: 6 additions & 0 deletions config/config.go
@@ -1,8 +1,14 @@
package config

import "fmt"

var (
version = "dev"
commit = "none"
date = "unknown"
)

func AppVersionInfo() (s string) {
s = fmt.Sprintf("version %v, commit %v, built at %v", version, commit, date)
return
}

0 comments on commit b29f417

Please sign in to comment.