Skip to content

New command structure alpha #103

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

Merged

Conversation

noplanman
Copy link
Member

Initial PR to continue discussion started in #87

This PR needs a thorough code review first before being merged!

Summary of main changes

  • Commands have been split up into 3 groups: System, Admin and User.
  • Custom commands included by the user override the default ones. If multiple folders with custom commands get included, the latest include takes preference.
  • Admin commands with the same name as User commands take preference when called by an admin.
  • Commands now return a ServerResponse object to offer more control after the command has executed (also used for testing commands).

(For a more detailed list of changes, follow the thread in #87, especially this comment)

noplanman and others added 29 commits February 18, 2016 01:33
Commands are split up into 3 categories: System, Admin and User.
They can be overridden individually by custom command directories.
STILL ALPHA STAGE!
Move start command to the system commands.
Fix some documentation and error outputs.
Correct and complete a few docblocks.
Rewrite custom JSON input for debugging. Remove custom JSON input in handle() method.
Fix issue that disabled or invalid commands died silently. Always output some "Command not found" message.
Remove $command from commands, not needed.
Minor docblock corrections.
…ecuted command response.

Fix getUpdate handler to incorporate new Update processing.
execute() method for ALL commands must now return a ServerResponse object, not a bool!!
handle() now returns a bool, handleGetUpdates() still returns a ServerResponse object.
…e loop.

Set default log verbosity on object creation to prevent potentially overwriting the value when calling setLogRequests().
Rename test Helpers class to TestHelpers.
@@ -10,16 +10,16 @@
* Written by Marco Boretto <[email protected]>
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

The command return ->isOk() insetad of serverResponse

@noplanman
Copy link
Member Author

Right you are, I missed that one, thanks! 😊

@MBoretto
Copy link
Collaborator

I also checked custom commands extension and everything works! well done man!

MBoretto added a commit that referenced this pull request Feb 24, 2016
@MBoretto MBoretto merged commit d49436d into php-telegram-bot:develop Feb 24, 2016
@noplanman noplanman deleted the new_command_structure_alpha branch February 24, 2016 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants