1
0
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:
coder2020official
2021-09-12 20:22:26 +05:00
parent 1ceec3cb54
commit 7d5e9e5111
5 changed files with 72 additions and 60 deletions

View File

@ -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)

View File

@ -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)