layout: trim slash symbol in commands

pull/447/head
Demian 3 years ago
parent fe3f4aa533
commit ec2cb655e7

@ -5,6 +5,7 @@ import (
"encoding/json"
"io/ioutil"
"log"
"strings"
"sync"
"text/template"
@ -162,7 +163,7 @@ func (lt *Layout) SetLocale(c tele.Context, locale string) {
func (lt *Layout) Commands() (cmds []tele.Command) {
for k, v := range lt.commands {
cmds = append(cmds, tele.Command{
Text: k,
Text: strings.TrimLeft(k, "/"),
Description: v,
})
}

@ -23,10 +23,10 @@ func TestLayout(t *testing.T) {
assert.Equal(t, &tele.LongPoller{}, pref.Poller)
assert.Equal(t, []tele.Command{{
Text: "/start",
Text: "start",
Description: "Start the bot",
}, {
Text: "/help",
Text: "help",
Description: "How to use the bot",
}}, lt.Commands())

Loading…
Cancel
Save