1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00
pyTelegramBotAPI/examples/text_filter_example.py
coder2020official 5f8c75816e Some useful filters
Created useful filters that can be used in message handlers.
Created some examples on using them.
2021-09-12 19:34:43 +05:00

17 lines
471 B
Python

import telebot
bot = telebot.TeleBot('TOKEN')
# Check if message starts with @admin tag
@bot.message_handler(text_startswith="@admin")
def start_filter(message):
bot.send_message(message.chat.id, "Looks like you are calling admin, wait...")
# Check if text is hi or hello
@bot.message_handler(text=['hi','hello'])
def text_filter(message):
bot.send_message(message.chat.id, "Hi, {name}!".format(name=message.from_user.first_name))
bot.polling(non_stop=True)