mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 19:58:54 -05:00
[Audio] Pagify playlists' lists
This commit is contained in:
parent
5f49e19214
commit
af9b4d7cec
@ -5,6 +5,7 @@ import os
|
|||||||
from random import shuffle, choice
|
from random import shuffle, choice
|
||||||
from cogs.utils.dataIO import dataIO
|
from cogs.utils.dataIO import dataIO
|
||||||
from cogs.utils import checks
|
from cogs.utils import checks
|
||||||
|
from cogs.utils.chat_formatting import pagify
|
||||||
from __main__ import send_cmd_help, settings
|
from __main__ import send_cmd_help, settings
|
||||||
from json import JSONDecodeError
|
from json import JSONDecodeError
|
||||||
import re
|
import re
|
||||||
@ -1230,14 +1231,11 @@ class Audio:
|
|||||||
@local.command(name="list", no_pm=True)
|
@local.command(name="list", no_pm=True)
|
||||||
async def list_local(self):
|
async def list_local(self):
|
||||||
"""Lists local playlists"""
|
"""Lists local playlists"""
|
||||||
local_playlists = self._list_local_playlists()
|
playlists = ", ".join(self._list_local_playlists())
|
||||||
if local_playlists:
|
if playlists:
|
||||||
msg = "```xl\n"
|
playlists = "Available local playlists:\n\n" + playlists
|
||||||
for p in local_playlists:
|
for page in pagify(playlists):
|
||||||
msg += "{}, ".format(p)
|
await self.bot.say(page)
|
||||||
msg = msg.strip(", ")
|
|
||||||
msg += "```"
|
|
||||||
await self.bot.say("Available local playlists:\n{}".format(msg))
|
|
||||||
else:
|
else:
|
||||||
await self.bot.say("There are no playlists.")
|
await self.bot.say("There are no playlists.")
|
||||||
|
|
||||||
@ -1439,14 +1437,12 @@ class Audio:
|
|||||||
@playlist.command(pass_context=True, no_pm=True, name="list")
|
@playlist.command(pass_context=True, no_pm=True, name="list")
|
||||||
async def playlist_list(self, ctx):
|
async def playlist_list(self, ctx):
|
||||||
"""Lists all available playlists"""
|
"""Lists all available playlists"""
|
||||||
files = self._list_playlists(ctx.message.server)
|
server = ctx.message.server
|
||||||
if files:
|
playlists = ", ".join(self._list_playlists(server))
|
||||||
msg = "```xl\n"
|
if playlists:
|
||||||
for f in files:
|
playlists = "Available playlists:\n\n" + playlists
|
||||||
msg += "{}, ".format(f)
|
for page in pagify(playlists):
|
||||||
msg = msg.strip(", ")
|
await self.bot.say(page)
|
||||||
msg += "```"
|
|
||||||
await self.bot.say("Available playlists:\n{}".format(msg))
|
|
||||||
else:
|
else:
|
||||||
await self.bot.say("There are no playlists.")
|
await self.bot.say("There are no playlists.")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user