telebot icon indicating copy to clipboard operation
telebot copied to clipboard

FIX: keep order of commands, better docs

Open dvordrova opened this issue 1 year ago • 4 comments

Came across some difficulties when used layout, one of that is commands usage:

every restart I have different set of commands, owning to it is map (made it list) not obvious to find way of templating commands (added to example.yml) and tests not obvious how to use SetCommands for all not specified locales (added it in layout docstring)

Previous try https://github.com/tucnak/telebot/pull/681

dvordrova avatar Aug 30 '24 08:08 dvordrova

@dvordrova I meant the fact that Commands is exposed but doesn't execute the commands as a template, which leads to the raw description content. What would I use it for?

https://github.com/tucnak/telebot/pull/681/files/d9dcbb41bfee07192e91c90fc9d4d3eba7b1ddfc#diff-36c59fae7f0af10b179a0e3781fe9ea9d14c5e5a99d6a36a1f24767010bca403R43

demget avatar Aug 31 '24 14:08 demget

What would I use it for?

@demget so you wouldn't it is just test representation of comment I added // "commands" must be not templates https://github.com/tucnak/telebot/pull/738/files#diff-cf94c60ab5f782ca8ed34204c5b19bb3e07930bf1379544b47b236ec9d315eb0R179

dvordrova avatar Aug 31 '24 18:08 dvordrova

Possible ways to resolve it I see

  1. either to make different settings file where commands are not templated and different test with Commands()
  2. or keep this test that shows that using this function can lead to raw templates in data you get from settings file

Which one do you prefer?

dvordrova avatar Aug 31 '24 18:08 dvordrova

b.SetCommands([]tb.Command{{Text: "test", Description: "test"}}, "", tb.CommandScopeDefault)
log.Println(b.Commands()) //[] <nil>
//why empty?

Is this expected behaviour?

Tarasovych avatar Apr 27 '25 09:04 Tarasovych