Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dispatcher.set_commands#1911

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Bibo-Joshi wants to merge1 commit intomasterfromset-commands
Closed

Dispatcher.set_commands#1911

Bibo-Joshi wants to merge1 commit intomasterfromset-commands

Conversation

Bibo-Joshi
Copy link
Member

@Bibo-JoshiBibo-Joshi commentedApr 20, 2020
edited
Loading

Proposal implementation for a feature as discussed in#1856
Tests can be simplified, once#1724 is merged.

Closes#1859

Copy link
Member

@PoolitzerPoolitzer left a comment

Choose a reason for hiding this comment

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

LGTM

@Bibo-JoshiBibo-Joshi added this to the13.0 milestoneJun 15, 2020
@lucasmezencio
Copy link

Hey@Bibo-Joshi could you fix the conflicts? Let's try to push this to be merged. 🙂

super(CommandHandler, self).__init__(
callback,
pass_update_queue=pass_update_queue,
pass_job_queue=pass_job_queue,
pass_user_data=pass_user_data,
pass_chat_data=pass_chat_data)

self.description = description
if self.description is not None and not 3 <= len(self.description) <= 256:
raise ValueError('Command description is not valid.')
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I should remove this. We don't usually perform such checks as TG will just return BadRequest if invalid and more importantly, the limitations might change

command. Defaults to :obj:`True`.
skip_empty (:obj:`bool`, optional): Whether to skip
:class:`telegram.ext.CommandHandler` s with an empty description. If :obj:`False`,
empty descriptions will be replaced by ``Command "<command>"``.
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Defaults to :obj:False

:class:`telegram.ext.CommandHandler` s with an empty description. If :obj:`False`,
empty descriptions will be replaced by ``Command "<command>"``.
alphabetical (:obj:`bool`, optional): Whether to sort commands by alphabetical order.
If :obj:`False`, commands are sorted in the same order, in with :meth:`add_handler`
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

with -> which

Copy link
MemberAuthor

@Bibo-JoshiBibo-Joshi left a comment

Choose a reason for hiding this comment

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

Need to check what happens if a command is set twice, which can quickly be the case e.g. withCommandHandler('cancel', …) as fallback for conversations

dp_bot_commands = []
for group in self.handlers:
for handler in self.handlers[group]:
if hasattr(handler, 'command') and hasattr(handler, 'description'):
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Rather just doisinstance(handler, CommandHandler). Also we should checkConversationHandlers forCommandHandlers

@Bibo-Joshi
Copy link
MemberAuthor

By now I'm not really confident anymore, that this is a good addition. It doesn't really save too many code lines and it probably covers only some use cases. Maybe it's better suited for an eventual contrib repo, see#1912. I'll remove from the v13 milestone for now

@Bibo-JoshiBibo-Joshi removed this from the13.0 milestoneAug 9, 2020
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 14, 2020
@JosXa
Copy link
Contributor

tl;dr Reasoning?

@Bibo-Joshi
Copy link
MemberAuthor

tl;dr Reasoning?

this

@JosXa
Copy link
Contributor

tl;dr Reasoning?

this

I only see

It doesn't really save too many code lines and it probably covers only some use cases

but I would have merged that :P

@Bibo-Joshi
Copy link
MemberAuthor

My reasoning is basically the same as why#854 got closed: There are valid use cases for this feature, but it can only ever cover a subset of the use cases. So we can merge and find ourselfes adding more and more as users want more use cases - or we don't and save the work of maintaining a very specific feature. And at least currently I prefere the latter … Mind you, I'm still very open for#1912! :)

@Bibo-JoshiBibo-Joshi deleted the set-commands branchSeptember 27, 2020 12:12
@Bibo-JoshiBibo-Joshi added 🔌 enhancementpr description: enhancement and removed enhancement labelsNov 3, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@lucasmezenciolucasmezenciolucasmezencio approved these changes

@PoolitzerPoolitzerPoolitzer approved these changes

Assignees
No one assigned
Labels
🔌 enhancementpr description: enhancement
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[FEATURE] Infere bot commands from CommandHandler and set them automatically
4 participants
@Bibo-Joshi@lucasmezencio@JosXa@Poolitzer

[8]ページ先頭

©2009-2025 Movatter.jp