mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Added file custom_filters
Added file with custom filters. Updated the examples
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import telebot
|
||||
from telebot import custom_filters
|
||||
|
||||
bot = telebot.TeleBot('TOKEN')
|
||||
bot = telebot.TeleBot('token')
|
||||
|
||||
|
||||
# Chat id can be private or supergroups.
|
||||
@ -13,4 +14,8 @@ def not_admin(message):
|
||||
bot.send_message(message.chat.id, "You are not allowed to use this command")
|
||||
|
||||
|
||||
# Do not forget to register
|
||||
bot.add_custom_filter(custom_filters.UserFilter())
|
||||
|
||||
|
||||
bot.polling(non_stop=True)
|
@ -1,4 +1,5 @@
|
||||
import telebot
|
||||
from telebot import custom_filters
|
||||
|
||||
bot = telebot.TeleBot('TOKEN')
|
||||
|
||||
@ -13,5 +14,8 @@ def start_filter(message):
|
||||
def text_filter(message):
|
||||
bot.send_message(message.chat.id, "Hi, {name}!".format(name=message.from_user.first_name))
|
||||
|
||||
# Do not forget to register filters
|
||||
bot.add_custom_filter(custom_filters.TextFilter())
|
||||
bot.add_custom_filter(custom_filters.TextStarts())
|
||||
|
||||
bot.polling(non_stop=True)
|
Reference in New Issue
Block a user