本文整理匯總了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))