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

Получение секретного ключа при старте бота https://t.me/ExampleComBot?start=TESTKEY #278

Closed
LVM911 opened this issue Sep 1, 2020 · 1 comment

Comments

@LVM911
Copy link

LVM911 commented Sep 1, 2020

Здравствуйте, каким методом можно получить секретный ключ при авторизации?

https://t.me/ExampleComBot?start=TESTKEY

Вот скрин из документации
6d4f060bf88559299221157bae2f0286
если я правильно понял его нужно получать тут
`$bot->command('start', function ($message) use ($bot) {
// получаем $TESTKEY
$bot->sendMessage($chat_id, "Вы авторизованы по коду $TESTKEY ","HTML");

});`

@LVM911
Copy link
Author

LVM911 commented Sep 1, 2020

решил так.

`$bot->command('start', function ($message) use ($bot) {
//Получаем рефера

	$text_refer = $message->getText();
    $refer = explode(' ' , $text_refer);
    if (count($refer) === 2) { // ['/start', '<uniqueCode>']
        $refer_id = $refer[1];
       
       if ($refer_id == true) {
           $bot->sendMessage($message->getChat()->getId(), "Ваш рефер $refer_id","HTML",false); 
       }
    }

});`

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