Y
Y
yayerbol2020-09-06 16:04:59
Python
yayerbol, 2020-09-06 16:04:59

How to make it so that the user of the Telegram bot could not get the function (bot) without subscribing to the channel (author)?

How to make it so that the user of the Telegram bot could not get the function (bot) without subscribing to the channel (author)? Namely, so that, when trying to receive a service, the bot would display a message: to receive the service, you must first subscribe to our channel.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kostyan4ik, 2020-09-06
@yayerbol

you need the bot to be in the channel itself, and when the bot writes a command available only to subscribers, it will execute the code:

if bot.get_chat_member('линк или ид канала', message.chat.id) != None:
    что он должен сделать на команду
else:
    bot.send_message(message.chat.id, 'Вы не по адресу, вам сначала в канал')

S
soremix, 2020-09-06
@SoreMix

Check if you have a subscription, if not, give a message

to receive the service, you must first subscribe to our channel

https://core.telegram.org/bots/api#getchatmember

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question