38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package plugins
|
||
|
||
import (
|
||
"fmt"
|
||
"kurumibot/utils"
|
||
"runtime"
|
||
"strings"
|
||
|
||
"git.nix13.pw/scuroneko/laniakea"
|
||
)
|
||
|
||
func RegisterService(bot *laniakea.Bot) {
|
||
p := laniakea.NewPlugin("service")
|
||
p.Payload(generalClose, "general.close")
|
||
|
||
p.Command(about, "about", "о боте")
|
||
bot.AddPlugins(p.Build())
|
||
}
|
||
|
||
func about(ctx *laniakea.MsgContext, _ *laniakea.DatabaseContext) {
|
||
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, _ *laniakea.DatabaseContext) {
|
||
ctx.CallbackDelete()
|
||
ctx.AnswerCbQuery()
|
||
}
|