many changes
This commit is contained in:
@@ -14,32 +14,30 @@ 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())
|
||||
p.NewCommand(about, "about")
|
||||
p.NewCommand(about, "о боте")
|
||||
return p
|
||||
}
|
||||
|
||||
func about(ctx *laniakea.MsgContext, _ *database.Context) {
|
||||
formatVersion := func() string {
|
||||
parts := strings.Split(laniakea.VersionString, "-")
|
||||
main := parts[0]
|
||||
if len(parts) > 1 {
|
||||
beta := strings.Join(strings.Split(parts[1], "."), " ")
|
||||
return main + " " + beta
|
||||
v := fmt.Sprintf("%d.%d.%d", laniakea.VersionMajor, laniakea.VersionMinor, laniakea.VersionPatch)
|
||||
if laniakea.VersionBeta > 0 {
|
||||
v += fmt.Sprintf(" Beta %d", laniakea.VersionBeta)
|
||||
}
|
||||
return main
|
||||
return v
|
||||
}
|
||||
out := []string{
|
||||
fmt.Sprintf("Версия Go: %s", runtime.Version()[2:]),
|
||||
fmt.Sprintf("Версия Laniakea: %s", formatVersion()),
|
||||
fmt.Sprintf("Время сборки: %s", utils.BuildTime),
|
||||
fmt.Sprintf("Git хеш: %s", utils.GitCommit),
|
||||
fmt.Sprintf("*Версия Go*: %s", runtime.Version()[2:]),
|
||||
fmt.Sprintf("*Версия Laniakea*: %s", formatVersion()),
|
||||
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)
|
||||
ctx.KeyboardMarkdown(laniakea.EscapePunctuation(strings.Join(out, "\n")), kb)
|
||||
}
|
||||
|
||||
func generalClose(ctx *laniakea.MsgContext, _ *database.Context) {
|
||||
|
||||
Reference in New Issue
Block a user