def resume(client, message): if player.STATE == State.Paused: player.STATE = State.Playing player.pause_resume() message.reply_text(_("pause_4")) else: message.reply_text(_("pause_5"))
def pause(client, message): if player.STATE in State.Playing: player.STATE = State.Paused player.pause_resume() message.reply_text(_("pause_1")) elif player.STATE == State.Paused: message.reply_text(_("pause_2")) else: message.reply_text(_("pause_3"))
async def resume(client, message): if player.STATE == State.Paused: player.STATE = State.Playing player.pause_resume() m = await message.reply_text(_("resumed")) else: m = await message.reply_text(_("cant_resume")) if m and message.chat.type != "private": await sleep(5) await m.delete() try: await message.delete() except: pass
def resume(client, message): if player.STATE == State.Paused: player.STATE = State.Playing player.pause_resume() m = message.reply_text(_("pause_4")) else: m = message.reply_text(_("pause_5")) if m and message.chat.type != "private": sleep(5) m.delete() try: message.delete() except: pass
async def pause(client, message): if player.STATE in State.Playing: player.STATE = State.Paused player.pause_resume() m = await message.reply_text(_("pause_1")) elif player.STATE == State.Paused: m = await message.reply_text(_("pause_2")) else: m = await message.reply_text(_("pause_3")) if m and message.chat.type != "private": await sleep(5) await m.delete() try: await message.delete() except: pass
async def callback(client, query): if query.from_user.id not in SUDO_USERS: await query.answer() return if query.data.endswith("volume"): current_volume = int(query.message.text.split()[-1].replace("%", "")) if query.data == "decrease_volume": volume = current_volume - 1 if volume < 0: volume = 0 volume = f"{volume}%" subprocess.Popen( ["pactl", "set-sink-volume", "MySink", volume] ).wait() await query.message.reply_text( _("current_volume").format(volume), reply_markup=InlineKeyboardMarkup( [ [ InlineKeyboardButton( "➖", callback_data="decrease_volume" ), InlineKeyboardButton( "➕", callback_data="increase_volume" ) ] ] ), quote=False ) await query.message.delete() await query.answer() elif query.data == "increase_volume": volume = current_volume + 1 if volume > 100: volume = 100 volume = f"{volume}%" subprocess.Popen( ["pactl", "set-sink-volume", "MySink", volume] ).wait() await query.message.reply_text( _("current_volume").format(volume), reply_markup=InlineKeyboardMarkup( [ [ InlineKeyboardButton( "➖", callback_data="decrease_volume" ), InlineKeyboardButton( "➕", callback_data="increase_volume" ) ] ] ), quote=False ) await query.message.delete() await query.answer() else: if query.data == "refresh": await query.message.edit_text( f10(), disable_web_page_preview=True, reply_markup=rm() ) await query.answer() elif query.data == "skip": player.STATE = State.Skipped player.abort() await query.message.edit_text( f10(), disable_web_page_preview=True, reply_markup=rm() ) await query.answer() elif query.data == "pause": if player.STATE == State.Paused: player.STATE = State.Playing elif player.STATE == State.Playing: player.STATE = State.Paused player.pause_resume() await query.message.edit_text( f10(), disable_web_page_preview=True, reply_markup=rm() ) await query.answer()
async def pause_resume(client, message): if player.pause_resume(): await message.reply_text(_("paused")) else: await message.reply_text(_("nothing_playing_pause"))