Python telegram.ext.Filters.audio() Examples

The following are 5 code examples of telegram.ext.Filters.audio(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module telegram.ext.Filters , or try the search function .
Example #1
Source File: handlers_messages.py    From TranscriberBot with GNU General Public License v3.0 6 votes vote down vote up
def audio(bot, update):
  chat_id = get_chat_id(update)
  voice_enabled = TBDB.get_chat_voice_enabled(chat_id)

  if voice_enabled == 0:
    return
  
  message = update.message or update.channel_post
  a = message.audio

  if voice_enabled == 2:
    pass
  else:
    TranscriberBot.get().voice_thread_pool.submit(
      process_media_voice, bot, update, a, "audio"
    ) 
Example #2
Source File: locks.py    From SkittBot with GNU General Public License v3.0 5 votes vote down vote up
def build_lock_message(chat_id):
    locks = sql.get_locks(chat_id)
    restr = sql.get_restr(chat_id)
    if not (locks or restr):
        res = "There are no current locks in this chat."
    else:
        res = "These are the locks in this chat:"
        if locks:
            res += "\n - sticker = `{}`" \
                   "\n - audio = `{}`" \
                   "\n - voice = `{}`" \
                   "\n - document = `{}`" \
                   "\n - video = `{}`" \
                   "\n - videonote = `{}`" \
                   "\n - contact = `{}`" \
                   "\n - photo = `{}`" \
                   "\n - gif = `{}`" \
                   "\n - url = `{}`" \
                   "\n - bots = `{}`" \
                   "\n - forward = `{}`" \
                   "\n - game = `{}`" \
                   "\n - location = `{}`".format(locks.sticker, locks.audio, locks.voice, locks.document,
                                                 locks.video, locks.videonote, locks.contact, locks.photo, locks.gif, locks.url,
                                                 locks.bots, locks.forward, locks.game, locks.location)
        if restr:
            res += "\n - messages = `{}`" \
                   "\n - media = `{}`" \
                   "\n - other = `{}`" \
                   "\n - previews = `{}`" \
                   "\n - all = `{}`".format(restr.messages, restr.media, restr.other, restr.preview,
                                            all([restr.messages, restr.media, restr.other, restr.preview]))
    return res 
Example #3
Source File: locks.py    From Marie-2.0-English with GNU General Public License v3.0 5 votes vote down vote up
def build_lock_message(chat_id):
    locks = sql.get_locks(chat_id)
    restr = sql.get_restr(chat_id)
    if not (locks or restr):
        res = "There are no current locks in this chat."
    else:
        res = "These are the locks in this chat:"
        if locks:
            res += "\n - sticker = `{}`" \
                   "\n - audio = `{}`" \
                   "\n - voice = `{}`" \
                   "\n - document = `{}`" \
                   "\n - video = `{}`" \
                   "\n - contact = `{}`" \
                   "\n - photo = `{}`" \
                   "\n - gif = `{}`" \
                   "\n - url = `{}`" \
                   "\n - bots = `{}`" \
                   "\n - forward = `{}`" \
                   "\n - game = `{}`" \
                   "\n - location = `{}`".format(locks.sticker, locks.audio, locks.voice, locks.document,
                                                 locks.video, locks.contact, locks.photo, locks.gif, locks.url,
                                                 locks.bots, locks.forward, locks.game, locks.location)
        if restr:
            res += "\n - messages = `{}`" \
                   "\n - media = `{}`" \
                   "\n - other = `{}`" \
                   "\n - previews = `{}`" \
                   "\n - all = `{}`".format(restr.messages, restr.media, restr.other, restr.preview,
                                            all([restr.messages, restr.media, restr.other, restr.preview]))
    return res 
Example #4
Source File: locks.py    From tgbot with GNU General Public License v3.0 5 votes vote down vote up
def build_lock_message(chat_id):
    locks = sql.get_locks(chat_id)
    restr = sql.get_restr(chat_id)
    if not (locks or restr):
        res = "There are no current locks in this chat."
    else:
        res = "These are the locks in this chat:"
        if locks:
            res += "\n - sticker = `{}`" \
                   "\n - audio = `{}`" \
                   "\n - voice = `{}`" \
                   "\n - document = `{}`" \
                   "\n - video = `{}`" \
                   "\n - videonote = `{}`" \
                   "\n - contact = `{}`" \
                   "\n - photo = `{}`" \
                   "\n - gif = `{}`" \
                   "\n - url = `{}`" \
                   "\n - bots = `{}`" \
                   "\n - forward = `{}`" \
                   "\n - game = `{}`" \
                   "\n - location = `{}`".format(locks.sticker, locks.audio, locks.voice, locks.document,
                                                 locks.video, locks.videonote, locks.contact, locks.photo, locks.gif, locks.url,
                                                 locks.bots, locks.forward, locks.game, locks.location)
        if restr:
            res += "\n - messages = `{}`" \
                   "\n - media = `{}`" \
                   "\n - other = `{}`" \
                   "\n - previews = `{}`" \
                   "\n - all = `{}`".format(restr.messages, restr.media, restr.other, restr.preview,
                                            all([restr.messages, restr.media, restr.other, restr.preview]))
    return res 
Example #5
Source File: locks.py    From EmiliaHikari with GNU General Public License v3.0 4 votes vote down vote up
def build_lock_message(chat_id):
	locks = sql.get_locks(chat_id)
	res = ""
	locklist = []
	permslist = []
	if locks:
		res += "*" + tl(chat_id, "Ini adalah kunci dalam obrolan ini:") + "*"
		if locks:
			locklist.append("sticker = `{}`".format(locks.sticker))
			locklist.append("audio = `{}`".format(locks.audio))
			locklist.append("voice = `{}`".format(locks.voice))
			locklist.append("document = `{}`".format(locks.document))
			locklist.append("video = `{}`".format(locks.video))
			locklist.append("contact = `{}`".format(locks.contact))
			locklist.append("photo = `{}`".format(locks.photo))
			locklist.append("gif = `{}`".format(locks.gif))
			locklist.append("url = `{}`".format(locks.url))
			locklist.append("bots = `{}`".format(locks.bots))
			locklist.append("forward = `{}`".format(locks.forward))
			locklist.append("game = `{}`".format(locks.game))
			locklist.append("location = `{}`".format(locks.location))
			locklist.append("rtl = `{}`".format(locks.rtl))
			locklist.append("button = `{}`".format(locks.button))
	permissions = dispatcher.bot.get_chat(chat_id).permissions
	permslist.append("messages = `{}`".format(permissions.can_send_messages))
	permslist.append("media = `{}`".format(permissions.can_send_media_messages))
	permslist.append("poll = `{}`".format(permissions.can_send_polls))
	permslist.append("other = `{}`".format(permissions.can_send_other_messages))
	permslist.append("previews = `{}`".format(permissions.can_add_web_page_previews))
	permslist.append("info = `{}`".format(permissions.can_change_info))
	permslist.append("invite = `{}`".format(permissions.can_invite_users))
	permslist.append("pin = `{}`".format(permissions.can_pin_messages))

	if locklist:
		# Ordering lock list
		locklist.sort()
		# Building lock list string
		for x in locklist:
			res += "\n - {}".format(x)
	res += "\n\n*" + tl(chat_id, "Ini adalah izin dalam obrolan ini:") + "*"
	for x in permslist:
		res += "\n - {}".format(x)
	return res