本文整理汇总了Python中telegram.ext.Filters.forwarded方法的典型用法代码示例。如果您正苦于以下问题:Python Filters.forwarded方法的具体用法?Python Filters.forwarded怎么用?Python Filters.forwarded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类telegram.ext.Filters
的用法示例。
在下文中一共展示了Filters.forwarded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from telegram.ext import Filters [as 别名]
# 或者: from telegram.ext.Filters import forwarded [as 别名]
def main():
logger.info("Loading handlers for telegram bot")
# Default dispatcher (this is related to the first bot in settings.TELEGRAM_BOT_TOKENS)
dp = DjangoTelegramBot.dispatcher
# To get Dispatcher related to a specific bot
# dp = DjangoTelegramBot.getDispatcher('BOT_n_token') #get by bot token
# dp = DjangoTelegramBot.getDispatcher('BOT_n_username') #get by bot username
# on different commands - answer in Telegram
dp.add_handler(CommandHandler("start", start))
dp.add_handler(CommandHandler("help", help))
dp.add_handler(CommandHandler("startgroup", startgroup))
dp.add_handler(CommandHandler("me", me))
dp.add_handler(CommandHandler("chat", chat))
dp.add_handler(MessageHandler(Filters.forwarded , forwarded))
# on noncommand i.e message - echo the message on Telegram
dp.add_handler(MessageHandler(Filters.text, echo))
# log all errors
dp.add_error_handler(error)
示例2: forwarded
# 需要导入模块: from telegram.ext import Filters [as 别名]
# 或者: from telegram.ext.Filters import forwarded [as 别名]
def forwarded(bot, update):
bot.sendMessage(update.message.chat_id, text='This msg forwaded information:\n {}'.format(update.effective_message))