diff --git a/layout/layout.go b/layout/layout.go index 830e9b9..f626ea0 100644 --- a/layout/layout.go +++ b/layout/layout.go @@ -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, }) } diff --git a/layout/layout_test.go b/layout/layout_test.go index 7805751..ee25331 100644 --- a/layout/layout_test.go +++ b/layout/layout_test.go @@ -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())