TelegramBot / Api

Native PHP Wrapper for Telegram BOT API
MIT License
1.09k stars 323 forks source link

Resend after command "сс" #304

Open Leelter opened 3 years ago

Leelter commented 3 years ago

How to use this script so that it only works after the "cc" command Ie I want him to send me a message too only after the command "сс".

This script works:

$bot->on(function (\TelegramBot\Api\Types\Update $update) use ($bot) {
    $message = $update->getMessage();
    $id = $message->getChat()->getId();
    $bot->sendMessage($id, $message->getText());
}, function () {
    return true;
});

But I want it this way but it doesn't work:

$bot->command('cc', on(function (\TelegramBot\Api\Types\Update $update) use ($bot)) {
    $message = $update->getMessage();
    $id = $message->getChat()->getId();
    $bot->sendMessage($id, $message->getText());
}, function () {
    return true;
});
MyZik commented 3 years ago

How do you try to use your command? Commands should be used as "/cc"

Leelter commented 3 years ago

How do you try to use your command? Commands should be used as "/cc"

After the command "cc" and the words Bot sent this word BUT only after the command

(i use google translate)