2021-09-12 17:34:43 +03:00
|
|
|
import telebot
|
2021-09-12 18:22:26 +03:00
|
|
|
from telebot import custom_filters
|
2021-09-12 17:34:43 +03:00
|
|
|
|
2021-09-12 18:22:26 +03:00
|
|
|
bot = telebot.TeleBot('token')
|
2021-09-12 17:34:43 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Chat id can be private or supergroups.
|
|
|
|
@bot.message_handler(chat_id=[12345678], commands=['admin']) # chat_id checks id corresponds to your list or not.
|
|
|
|
def admin_rep(message):
|
|
|
|
bot.send_message(message.chat.id, "You are allowed to use this command.")
|
|
|
|
|
|
|
|
@bot.message_handler(commands=['admin'])
|
|
|
|
def not_admin(message):
|
|
|
|
bot.send_message(message.chat.id, "You are not allowed to use this command")
|
|
|
|
|
2021-09-12 18:22:26 +03:00
|
|
|
# Do not forget to register
|
2021-09-12 19:36:23 +03:00
|
|
|
bot.add_custom_filter(custom_filters.ChatFilter())
|
2021-09-12 18:22:26 +03:00
|
|
|
|
2021-09-28 19:17:09 +03:00
|
|
|
bot.infinity_polling()
|