M
M
mariksolohin2020-10-10 19:18:55
Python
mariksolohin, 2020-10-10 19:18:55

User ban via Telegram Python bot?

How to make it so that I can ban a user through my account through his id.

/ban userid

Language: Python3
Library: Aiogram
(Block NOT IN CHAT, but in the bot itself)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lesha, 2020-10-10
@mariksolohin

Take any database, even a json file and create a blacklist
table/array . And in the bot you get an ID on command (but first check by ID that the sender is you) and если не существует в базе > добавитьupdate the database using the construction.
And then the simplest (approximate pseudocode)

if user_id in blocklist_db:
    return

if the sender's ID is in the database - ignore

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question