A
A
Arthur2021-10-21 22:22:43
Python
Arthur, 2021-10-21 22:22:43

Admin on telebot?

I know there is a method with which you can write some command to a bot, for example /admin, and it only works when the creator of the bot sends (by its id)
And if sent, for example, by a beginner, he will be told that you do not have rights, etc.

How to do this ?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
GavriKos, 2021-10-21
@GavriKos

In the command handler, check who sent and that's it.
Perhaps there is something out of the box, but even so there is a banal if.

R
RRRRRRR7, 2021-10-22
@RRRRRRRR7

If you make an admin panel, then check for user_id, if it matches, then display your message.

T
tsoy4uk, 2021-10-22
@tsoy4uk

admin = ['admin_chat_id' , 'admin_first_name' ]

..
..

def start(message):
 if str(message.from_user.id) in admin and message.from_user.first_name in admin:
      bot.send_message(message.from_user.id, 'Привет, великий!')
else:
    bot.send_message(message.from_user.id, 'Пшел вон! незванный')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question