def play_playlist(client, message): playlist = db.get_playlist("custom")["items"] if not playlist: message.reply_text(_("playlist_1")) elif player.is_currently_playing(): message.reply_text(_("playlist_9")) else: message.reply_text(_("playlist_2")) for item in playlist: download( item["url"], message.from_user.id, message.from_user.first_name, func( player.play, log=func( client.send_photo, chat_id=LOG_GROUP, caption=_("group_1").format( '<a href="{}">{}</a>', "{}", '<a href="tg://user?id={}">{}</a>', ), parse_mode="HTML", reply_markup=InlineKeyboardMarkup([ [ InlineKeyboardButton(_("playlist_6"), "rm_from_playlist"), ], ]), ), ) if LOG_GROUP else None, )
def playlist(client, message): if message.from_user.id in BANNED_USERS: message.reply_text(_("ban_9")) return if message.from_user.id not in SUDO_FILTER: message.reply_text(_("n4u")) return all_ = db.get_playlist("custom")["items"] if not all_: message.reply_text(_("playlist_1")) return _all = "" for i in range(len(all_)): _all += str(i + 1) + ". " + \ all_[i]["title"] + ": " + all_[i]["url"] + "\n" if len(_all) < 4096: message.reply_text(_all, parse_mode=None, disable_web_page_preview=True) else: message.reply_text("https://nekobin.com/" + requests.post( "https://nekobin.com/api/documents", data={ "content": _all }).json()["result"]["key"])