Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: keep order of commands, better docs #738

Open
wants to merge 2 commits into
base: v3
Choose a base branch
from

Conversation

dvordrova
Copy link

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 #681

Text: "start",
Description: "Start the bot",
}, {
Text: "help",
Description: "How to use the bot",
}, {
Text: "settings",
Description: "{{ text `cmd_settings` }}",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous pr had a question about testing this part of template
#681 (comment)

The reasons to keep lt.Commands in tests:

  1. make it clear what happens when you use templates with lt.Commands()
  2. the test already contained testing of both Commands and CommandsLocale functions, kept it here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@demget should I check anything else before you run CI workflow?

@dvordrova dvordrova changed the title Sort commands FIX: keep order of commands, better docs Aug 30, 2024
@demget
Copy link
Collaborator

demget commented Aug 31, 2024

@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

@dvordrova
Copy link
Author

dvordrova commented Aug 31, 2024

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
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants