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

Request limiter should accept chat ID as integer and string #1176

Closed
noplanman opened this issue Feb 2, 2021 · 3 comments
Closed

Request limiter should accept chat ID as integer and string #1176

noplanman opened this issue Feb 2, 2021 · 3 comments
Assignees
Labels

Comments

@noplanman
Copy link
Member

🐞 Bug Report

Summary

Request limiter currently only works for requests that pass the chat id as integer values.
This needs to be cleaned up, to allow both integer and string (for @channels and @groups).

Reported here:
https://t.me/PHP_Telegram_Bot_Support/27539

Current behaviour

Error message:

telegram_bot.ERROR: Argument 1 passed to Longman\TelegramBot\DB::getTelegramRequestCount() must be of the type int or null, string given, called in /vendor/longman/telegram-bot/src/Request.php on line 877 [] []

if (!($requests = DB::getTelegramRequestCount($chat_id, $inline_message_id))) {

How to reproduce

Send a request with $data['chat_id'] = '@channel'; for example.

Expected behaviour

It should work with both integer and string chat ID values.

@noplanman noplanman added the bug label Feb 2, 2021
@noplanman noplanman self-assigned this Feb 2, 2021
@Sergey-Shabanov
Copy link

Good afternoon, can you please tell me how to add such a beautiful display of a code fragment when filling out a ticket?

@noplanman
Copy link
Member Author

@Sergey-Shabanov Off-topic, but you can do that by pasting a direct link to a line of code. GitHub then automatically makes it "pretty" 😃

The link i posted in the issue here, is this: https://github.com/php-telegram-bot/core/blob/2093cffa2a8e0497d12183178e17cadcc1d0f6d5/src/Request.php#L877

@Sergey-Shabanov
Copy link

So I did, but I didn't get nice formatting. I will try again. Anyway, thanks for the explanation, and have a nice day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants