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

Dealing with undefined commands #26

Closed
manolab opened this issue Aug 31, 2015 · 2 comments
Closed

Dealing with undefined commands #26

manolab opened this issue Aug 31, 2015 · 2 comments

Comments

@manolab
Copy link

manolab commented Aug 31, 2015

Hi!

If the bot receives an undefined command something like that is thrown in the apache logs:

[Mon Aug 31 10:55:02.370494 2015] [:error] [pid 17414] [client 149.154.167.198:47253] PHP Fatal error:  Class 'Longman\\TelegramBot\\Commands\\GeloCommand' not found in /var/www/html/bot/vendor/longman/telegram-bot/src/Telegram.php

How can I deal with that? Which class do I need to tamper with to catch that error and, for example, reply some text to suggest the use of /help??

Thanks!

@MBoretto
Copy link
Collaborator

Thank for reporting!
you can try to modify this line:
https://github.com/akalongman/php-telegram-bot/blob/master/src/Telegram.php#L375
with:
if ($class) {
anyway i will fix it in the next relase

@manolab
Copy link
Author

manolab commented Aug 31, 2015

Thanks! I extended the Telegram class with my version of executeCommand function and all works as I wanted!

@manolab manolab closed this as completed Aug 31, 2015
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

No branches or pull requests

2 participants