refactoring, fixes and laniakea v0.8
This commit is contained in:
@@ -2,23 +2,24 @@ package plugins
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"kurumibot/utils"
|
||||
"runtime"
|
||||
"strings"
|
||||
"ymgb/database"
|
||||
"ymgb/utils"
|
||||
|
||||
"git.nix13.pw/scuroneko/laniakea"
|
||||
)
|
||||
|
||||
func RegisterService(bot *laniakea.Bot) {
|
||||
p := laniakea.NewPlugin("service")
|
||||
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())
|
||||
bot.AddPlugins(p)
|
||||
return p
|
||||
}
|
||||
|
||||
func about(ctx *laniakea.MsgContext, _ *laniakea.DatabaseContext) {
|
||||
func about(ctx *laniakea.MsgContext, _ *database.Context) {
|
||||
out := []string{
|
||||
fmt.Sprintf("Версия Go: %s", runtime.Version()[2:]),
|
||||
fmt.Sprintf("Версия Laniakea: %s", laniakea.VersionString),
|
||||
@@ -32,7 +33,7 @@ func about(ctx *laniakea.MsgContext, _ *laniakea.DatabaseContext) {
|
||||
ctx.Keyboard(strings.Join(out, "\n"), kb)
|
||||
}
|
||||
|
||||
func generalClose(ctx *laniakea.MsgContext, _ *laniakea.DatabaseContext) {
|
||||
func generalClose(ctx *laniakea.MsgContext, _ *database.Context) {
|
||||
ctx.CallbackDelete()
|
||||
ctx.AnswerCbQuery()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user