Skip to content

Remove obsolete service message system commands #999

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

Conversation

noplanman
Copy link
Member

@noplanman noplanman commented Aug 30, 2019

? !
Type bug / improvement
BC Break no
Fixed issues #994

Summary

Remove all obsolete service message system commands and instead try to execute any user-defined overrides directly in GenericmessageCommand.

Usage

You need to set SystemCommand::$execute_deprecated = true; before handling the request, either in your hook or getUpdates file.

If you have a custom GenericmessageCommand implementation, you'll need to add the code snippet from the original GenericmessageCommand.php to your own.

@noplanman noplanman requested a review from jacklul August 30, 2019 17:41
@noplanman noplanman self-assigned this Aug 30, 2019
@jacklul
Copy link
Collaborator

jacklul commented Aug 31, 2019

I don't think renaming GenericmessageCommand to MessageCommand is a good idea, might get confusing when people create /message commands (no idea about class name conflicts but IDE's might get confused?).

Assuming we get to implement #919 they should be able simply to extend this and parent::execute() (check if empty response) instead of creating new class and copying code, this also prevents people from removing essential code for handling conversations.

@noplanman
Copy link
Member Author

@jacklul I've updated this a bit and moved the code to SystemCommand, to make the integration into a custom GenericmessageCommand easier.

Also, there's a property SystemCommand::$execute_deprecated which needs to be set for this to work. I added this, to not have all the code run for users who don't need this feature.

Any thoughts are highly appreciated! 🙏

I'm also thinking about how best to implement the new command system, to make it logical and easy to use.

@noplanman noplanman requested a review from jacklul September 4, 2019 17:36
@noplanman noplanman changed the title WIP: Remove obsolete service message system commands Remove obsolete service message system commands Sep 14, 2019
@noplanman noplanman merged commit e9c6939 into php-telegram-bot:develop Sep 14, 2019
@noplanman noplanman deleted the 994-remove_service_message_system_commands branch October 24, 2019 23:30
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