40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package plugins
|
||
|
||
import (
|
||
"fmt"
|
||
"runtime"
|
||
"strings"
|
||
"ymgb/database"
|
||
"ymgb/utils"
|
||
|
||
"git.nix13.pw/scuroneko/laniakea"
|
||
)
|
||
|
||
func RegisterService() *laniakea.Plugin[database.Context] {
|
||
p := laniakea.NewPlugin[database.Context]("service")
|
||
p.AddPayload(p.NewCommand(generalClose, "general.close"))
|
||
|
||
p.AddCommand(p.NewCommand(about, "about"))
|
||
p.AddCommand(p.NewCommand(about, "о боте").SkipCommandAutoGen())
|
||
return p
|
||
}
|
||
|
||
func about(ctx *laniakea.MsgContext, _ *database.Context) {
|
||
out := []string{
|
||
fmt.Sprintf("Версия Go: %s", runtime.Version()[2:]),
|
||
fmt.Sprintf("Версия Laniakea: %s", laniakea.VersionString),
|
||
fmt.Sprintf("Время сборки: %s", utils.BuildTime),
|
||
fmt.Sprintf("Git хеш: %s", utils.GitCommit),
|
||
}
|
||
|
||
kb := laniakea.NewInlineKeyboard(2)
|
||
kb.AddUrlButtonStyle("Канал", laniakea.ButtonStylePrimary, "https://t.me/ym_gbot_news")
|
||
kb.AddUrlButtonStyle("Чат", laniakea.ButtonStylePrimary, "https://t.me/ym_gbot_chat")
|
||
ctx.Keyboard(strings.Join(out, "\n"), kb)
|
||
}
|
||
|
||
func generalClose(ctx *laniakea.MsgContext, _ *database.Context) {
|
||
ctx.CallbackDelete()
|
||
ctx.AnswerCbQuery()
|
||
}
|