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

Update README.md

This commit is contained in:
_run 2021-09-12 20:41:26 +05:00 committed by GitHub
parent 5c715dabc3
commit 4071ab9124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -306,7 +306,7 @@ If you want to add some built-in filter, you are welcome to add it in custom_fil
Here is example of creating filter-class:
```
```python
class IsAdmin(util.SimpleCustomFilter):
# Class will check whether the user is admin or creator in group or not
key='is_admin'
@ -314,14 +314,10 @@ class IsAdmin(util.SimpleCustomFilter):
def check(message: telebot.types.Message):
return bot.get_chat_member(message.chat.id,message.from_user.id).status in ['administrator','creator']
# To register filter, you need to use method add_custom_filter.
bot.add_custom_filter(IsAdmin())
# Now, you can use it in handler.
@bot.message_handler(is_admin=True)
```