P
P
Python Newbie2021-09-26 07:27:02
Bots
Python Newbie, 2021-09-26 07:27:02

How to add users to the blacklist and get them from there in a telegram channel using pytelegrambotapi?

I need to kick the user out of the channel and deny him access, and then allow access using the same link. How to do it on pytelegrambotapi?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jerwright, 2021-09-26
@Levman5

Try like this:

bot.ban_chat_member(chat_id, user_id)
#Если нужно вернуть, то используйте unban_chat_member
bot.unban_chat_member(chat_id, user_id)

Instead of chat_id, you need to use the channel / chat ID, and user_id - the user ID, respectively

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question