Python telegram.ext.Filters 模块,audio() 实例源码

我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用telegram.ext.Filters.audio()

项目:JackOfAllGroups-telegram-bot    作者:Kyraminol    | 项目源码 | 文件源码
def send_media(bot, chat_id, media_type, media_id, text, reply_to_id=None):
    if media_type == "audio":
        bot.send_audio(chat_id=chat_id, audio=media_id, reply_to_message_id=reply_to_id)
    elif media_type == "document":
        bot.send_document(chat_id=chat_id, document=media_id, caption=text, reply_to_message_id=reply_to_id)
    elif media_type == "photo":
        bot.send_photo(chat_id=chat_id, photo=media_id, caption=text, reply_to_message_id=reply_to_id)
    elif media_type == "sticker":
        bot.send_sticker(chat_id=chat_id, sticker=media_id, reply_to_message_id=reply_to_id)
    elif media_type == "video":
        bot.send_video(chat_id=chat_id, video=media_id, caption=text, reply_to_message_id=reply_to_id)
    elif media_type == "voice":
        bot.send_voice(chat_id=chat_id, voice=media_id, reply_to_message_id=reply_to_id)
项目:JackOfAllGroups-telegram-bot    作者:Kyraminol    | 项目源码 | 文件源码
def main():
    updater = Updater("INSERT TOKEN HERE")
    dp = updater.dispatcher
    dp.add_handler(CommandHandler("start", cmd_start))
    dp.add_handler(CommandHandler("md", cmd_markdown, allow_edited=True))
    dp.add_handler(CommandHandler("markdown", cmd_markdown, allow_edited=True))
    dp.add_handler(CommandHandler("pin", cmd_pin, allow_edited=True))
    dp.add_handler(CommandHandler("welcome", cmd_welcome, allow_edited=True))
    dp.add_handler(CommandHandler("goodbye", cmd_goodbye, allow_edited=True))
    dp.add_handler(CommandHandler("del_welcome", cmd_clear_welcome))
    dp.add_handler(CommandHandler("del_goodbye", cmd_clear_goodbye))
    dp.add_handler(CommandHandler("set_bot_admin", cmd_set_bot_admin, allow_edited=True))
    dp.add_handler(CommandHandler("remove_bot_admin", cmd_remove_bot_admin, allow_edited=True))
    dp.add_handler(CommandHandler("settings", cmd_settings))
    dp.add_handler(CommandHandler("shortcut", cmd_shortcut_set, allow_edited=True))
    dp.add_handler(CommandHandler("del_shortcut", cmd_shortcut_del, allow_edited=True))
    dp.add_handler(CommandHandler("shortcuts", cmd_shortcut_getall, allow_edited=True))
    dp.add_handler(MessageHandler(Filters.audio |
                                  Filters.command |
                                  Filters.contact |
                                  Filters.document |
                                  Filters.photo |
                                  Filters.sticker |
                                  Filters.text |
                                  Filters.video |
                                  Filters.voice |
                                  Filters.status_update, msg_parse, allow_edited=True))
    dp.add_handler(CallbackQueryHandler(inline_button_callback))
    dp.add_error_handler(error)
    updater.start_polling()
    updater.idle()
项目:tgbot    作者:PaulSonOfLars    | 项目源码 | 文件源码
def del_audio(bot, update):
    chat = update.effective_chat
    if sql.is_locked(chat.id, "audio") and can_delete(chat, bot.id):
        update.effective_message.delete()