1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00
pyTelegramBotAPI/examples/asynchronous_telebot/custom_filters/admin_filter_example.py

15 lines
408 B
Python
Raw Normal View History

2021-11-27 21:41:39 +03:00
from telebot.async_telebot import AsyncTeleBot
from telebot import asyncio_filters
2021-12-12 13:13:07 +03:00
bot = AsyncTeleBot('TOKEN')
2021-11-27 21:41:39 +03:00
# Handler
@bot.message_handler(chat_types=['supergroup'], is_chat_admin=True)
async def answer_for_admin(message):
await bot.send_message(message.chat.id,"hello my admin")
# Register filter
bot.add_custom_filter(asyncio_filters.IsAdminFilter(bot))
2021-12-12 13:07:30 +03:00
import asyncio
asyncio.run(bot.polling())