X Tutup
The Wayback Machine - https://web.archive.org/web/20200918093130/https://github.com/php-telegram-bot/core/issues/807
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

User authentication using channel #807

Open
supersh86 opened this issue Mar 23, 2018 · 6 comments
Open

User authentication using channel #807

supersh86 opened this issue Mar 23, 2018 · 6 comments
Labels

Comments

@supersh86
Copy link

@supersh86 supersh86 commented Mar 23, 2018

hello
How to make bot work only for channel subscribers?

I have the code.

$infochat = Request::getChatMember(['chat_id'=> '@channelname', 'user_id'=> 'userid']);
$infochatarr =  json_decode($infochat, true);

if ($infochatarr['result']['status'] == 'left') {
    $infos = [
        'chat_id' => 'userid',
        'text' => 'please subscribe to @channelname'
    ];
    Request::sendMessage($infos);
}

Now I need to understand how to block the work of the bot while the user does not subscribe to the channel.

@jacklul
Copy link
Collaborator

@jacklul jacklul commented Mar 23, 2018

Best solution would be to extend Telegram class and add filtering logic to processUpdate method.

@supersh86
Copy link
Author

@supersh86 supersh86 commented Mar 26, 2018

please example

@akalongman
Copy link
Member

@akalongman akalongman commented May 10, 2018

@supersh86 there is a good example by @jacklul #792 (comment)

@akalongman akalongman added the question label May 10, 2018
@minhvn
Copy link

@minhvn minhvn commented Jun 17, 2018

Is it still working?
$infochat = Request::getChatMember(['chat_id'=> '@channelname', 'user_id'=> 'userid']);
Im using that for chat user has join group but in return chat not found :(

@KraToS-zz
Copy link

@KraToS-zz KraToS-zz commented Jun 29, 2019

@supersh86 there is a good example by @jacklul #792 (comment)

Can you send a working example for this ? i dont get it :-(

@noplanman
Copy link
Member

@noplanman noplanman commented Jul 3, 2019

@KraToS-zz What exactly don't you understand with the example that @jacklul posted?

You can create a new file with that code in it and then use new TelegramBot instead of new Telegram in your webhook or getUpdates.

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

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.
X Tutup