UserCommands are called on Update types with same name (PollCommand on poll Update etc.)
When defining a PollCommand extends UserCommand and added via addCommandClass(),
this classes execute method is also called, when an Update of type Poll comes in.
I think on Update Types, it should check, if the registered class is extending SystemCommand.
@TiiFuchs This is because of the way the commands were implemented way back when.
<UpdateType>Command classes get called when an Update comes in.
From what I recall, if you leave the $name blank, it doesn't get called. Or maybe that was only the case when a user executes it :thinking:
There are a bunch of issues open regarding the current command system, and this particular scenario has come up before I think.
We should think about a way to solve this. I think the current behaviour as described can get pretty frustrating.
Any idea?
I don't like that different Update Types call something like ...Command... It is not a Command, it should not be called that way. Maybe we can change this to ...Update or something... So when there is a new Update with type poll, it looks for a PollUpdate class, if it is an inline_query it looks for InlineQueryUpdate etc.
What do you think, @noplanman
I like the idea of having dedicated <Type>Update classes to cleanly separate user commands and updates coming in from Telegram.
There are a few issues labled "code design" which are about this too.
I think we can hugely improve the whole flow of a request cycle.