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

Merge pull request #1308 from coder2020official/master

Added example and editd description.
This commit is contained in:
Badiboy 2021-09-14 13:08:45 +03:00 committed by GitHub
commit f854163626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,21 @@
import telebot
from telebot import custom_filters
bot = telebot.TeleBot('TOKEN')
# Check if message is a reply
@bot.message_handler(is_reply=True)
def start_filter(message):
bot.send_message(message.chat.id, "Looks like you replied to my message.")
# Check if message was forwarded
@bot.message_handler(is_forwarded=True)
def text_filter(message):
bot.send_message(message.chat.id, "I do not accept forwarded messages!")
# Do not forget to register filters
bot.add_custom_filter(custom_filters.IsReplyFilter())
bot.add_custom_filter(custom_filters.ForwardFilter())
bot.polling(non_stop=True)

View File

@ -87,7 +87,7 @@ class ChatFilter(AdvancedCustomFilter):
class ForwardFilter(SimpleCustomFilter): class ForwardFilter(SimpleCustomFilter):
""" """
Check whether message was forwarded. Check whether message was forwarded from channel or group.
Example: Example: