irazasyed / telegram-bot-sdk

🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
https://telegram-bot-sdk.com
BSD 3-Clause "New" or "Revised" License
3.05k stars 673 forks source link

Telegram Bot Not Response #248

Closed andhikamaheva closed 8 years ago

andhikamaheva commented 8 years ago

I'm using laravel 5.3 and dev-master telegram-bot-sdk. I have a problem, my bot not respond when i send a message but i can send a message to my telegram account with function sendMessage() This problem happened last night.

Is there something wrong ? or the core problem of the telegram API?

irazasyed commented 8 years ago

Check to see if Async is turned on globally or anywhere else and turn it off.

What does sendMessage() return if it isn't an object? Please post the code.

andhikamaheva commented 8 years ago

Async option is turn off. I tried removeWebhook and setWebhook then some messages from my last command can be sent.

p.s : setWebhook without self-signed-cert

andhikamaheva commented 8 years ago

Telegram API have limit request ?

irazasyed commented 8 years ago

Here are the details for the API rate limitations. It's ~30 messages to different users per second.

As far as your issue is concerned, Can you post your config (Ofc redact your token)?

andhikamaheva commented 8 years ago

`<?php

return [ /* -------------------------------------------------------------------------- Default Bot Name
Here you may specify which of the bots below you wish to use as
your default bot for regular use. Of course, you may use many
bots at once using the manager class.
*/
'default'                      => 'andhika',
/*
|--------------------------------------------------------------------------
| Telegram Bots
|--------------------------------------------------------------------------
|
| Here are each of the telegram bots config.
|
| Supported Params:
| - username: Your Telegram Bot's Username.
|         Example: (string) 'BotFather'.
|
| - token: Your Telegram Bot's Access Token.
           Refer for more details: https://core.telegram.org/bots#botfather
|          Example: (string) '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11'.
|
| - commands: (Optional) Commands to register for this bot,
|             Supported Values: "Command Group Name", "Shared Command Name", "Full Path to Class".
|             Default: Registers Global Commands.
|             Example: (array) [
|               'admin', // Command Group Name.
|               'status', // Shared Command Name.
|               Acme\Project\Commands\BotFather\HelloCommand::class,
|               Acme\Project\Commands\BotFather\ByeCommand::class,
|             ]
*/
'bots'                         => [
    'common' => [
        'username' => 'SicycaBot',
        'token'    => env('TELEGRAM_BOT_TOKEN', 'XXX'),
        'commands' => [
            //App\Http\Controllers\HelpCommand::class,
            //Acme\Project\Commands\MyTelegramBot\BotCommand::class
            //App\Http\Telegram\Commands\HelpCommand::class,
        ],
    ],
    'andhika' => [
        'username' => 'AndhikaBot',
        'token'    => env('TELEGRAM_BOT_TOKEN', 'XXX'),
        'commands' => [
            //App\Http\Controllers\HelpCommand::class,
            //Acme\Project\Commands\MyTelegramBot\BotCommand::class
            //App\Http\Telegram\Commands\HelpCommand::class,
        ],
    ],

    //        'second' => [
    //            'username'  => 'MySecondBot',
    //            'token' => '123456:abc',
    //        ],
],

/*
|--------------------------------------------------------------------------
| Asynchronous Requests [Optional]
|--------------------------------------------------------------------------
|
| When set to True, All the requests would be made non-blocking (Async).
|
| Default: false
| Possible Values: (Boolean) "true" OR "false"
|
*/
'async_requests'               => env('TELEGRAM_ASYNC_REQUESTS', false),

/*
|--------------------------------------------------------------------------
| HTTP Client Handler [Optional]
|--------------------------------------------------------------------------
|
| If you'd like to use a custom HTTP Client Handler.
| Should be an instance of \Telegram\Bot\HttpClients\HttpClientInterface
|
| Default: GuzzlePHP
|
*/
'http_client_handler'          => null,

/*
|--------------------------------------------------------------------------
| Resolve Injected Dependencies in commands [Optional]
|--------------------------------------------------------------------------
|
| Using Laravel's IoC container, we can easily type hint dependencies in
| our command's constructor and have them automatically resolved for us.
|
| Default: true
| Possible Values: (Boolean) "true" OR "false"
|
*/
'resolve_command_dependencies' => true,

/*
|--------------------------------------------------------------------------
| Register Telegram Global Commands [Optional]
|--------------------------------------------------------------------------
|
| If you'd like to use the SDK's built in command handler system,
| You can register all the global commands here.
|
| Global commands will apply to all the bots in system and are always active.
|
| The command class should extend the \Telegram\Bot\Commands\Command class.
|
| Default: The SDK registers, a help command which when a user sends /help
| will respond with a list of available commands and description.
|
*/
'commands'                     => [
    //Telegram\Bot\Commands\HelpCommand::class,
    App\Http\Telegram\Commands\HelpCommand::class,
    App\Http\Telegram\Commands\StartCommand::class,
    //   App\Http\Telegram\Commands\HelpCommand::class,
],

/*
|--------------------------------------------------------------------------
| Command Groups [Optional]
|--------------------------------------------------------------------------
|
| You can organize a set of commands into groups which can later,
| be re-used across all your bots.
|
| You can create 4 types of groups:
| 1. Group using full path to command classes.
| 2. Group using shared commands: Provide the key name of the shared command
| and the system will automatically resolve to the appropriate command.
| 3. Group using other groups of commands: You can create a group which uses other
| groups of commands to bundle them into one group.
| 4. You can create a group with a combination of 1, 2 and 3 all together in one group.
|
| Examples shown below are by the group type for you to understand each of them.
*/
'command_groups'               => [
    /* // Group Type: 1
       'commmon' => [
            Acme\Project\Commands\TodoCommand::class,
            Acme\Project\Commands\TaskCommand::class,
       ],
    */

    /* // Group Type: 2
       'subscription' => [
            'start', // Shared Command Name.
            'stop', // Shared Command Name.
       ],
    */

    /* // Group Type: 3
        'auth' => [
            Acme\Project\Commands\LoginCommand::class,
            Acme\Project\Commands\SomeCommand::class,
        ],

        'stats' => [
            Acme\Project\Commands\UserStatsCommand::class,
            Acme\Project\Commands\SubscriberStatsCommand::class,
            Acme\Project\Commands\ReportsCommand::class,
        ],

        'admin' => [
            'auth', // Command Group Name.
            'stats' // Command Group Name.
        ],
    */

    /* // Group Type: 4
       'myBot' => [
            'admin', // Command Group Name.
            'subscription', // Command Group Name.
            'status', // Shared Command Name.
            'Acme\Project\Commands\BotCommand' // Full Path to Command Class.
       ],
    */
],

/*
|--------------------------------------------------------------------------
| Shared Commands [Optional]
|--------------------------------------------------------------------------
|
| Shared commands let you register commands that can be shared between,
| one or more bots across the project.
|
| This will help you prevent from having to register same set of commands,
| for each bot over and over again and make it easier to maintain them.
|
| Shared commands are not active by default, You need to use the key name to register them,
| individually in a group of commands or in bot commands.
| Think of this as a central storage, to register, reuse and maintain them across all bots.
|
*/
'shared_commands'              => [
    // 'start' => Acme\Project\Commands\StartCommand::class,
    // 'stop' => Acme\Project\Commands\StopCommand::class,
    // 'status' => Acme\Project\Commands\StatusCommand::class,
],

];`

I solved this with create new Bot :laughing: hmm