mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
support for sfx list >2k characters
didn't add paging to the other list commands as per request be Twentysix?? I may have misunderstood. Doesn't account for sfx with emoji in their names. I'm not sure if that's even possible.
This commit is contained in:
parent
3cb7ea02ad
commit
607cde76f4
@ -465,16 +465,25 @@ class Audio:
|
|||||||
|
|
||||||
@_list.command(name="sfx", pass_context=True)
|
@_list.command(name="sfx", pass_context=True)
|
||||||
async def list_sfx(self, ctx):
|
async def list_sfx(self, ctx):
|
||||||
msg = "Available local sound effects: \n\n```"
|
msgs = ["Available local sound effects: \n\n```\n"]
|
||||||
files = self.get_local_sfx()
|
files = self.get_local_sfx()
|
||||||
|
m = 0
|
||||||
|
maxm = 1980
|
||||||
if files:
|
if files:
|
||||||
for i, d in enumerate(files.keys()):
|
for i, d in enumerate(files.keys()):
|
||||||
|
if len(d) < maxm: #how did you get a filename this large?
|
||||||
|
if len(msgs[m]) + len(d) > maxm:
|
||||||
|
msgs[m] += "```"
|
||||||
|
m += 1
|
||||||
|
msgs.append("```\n")
|
||||||
if i % 4 == 0 and i != 0:
|
if i % 4 == 0 and i != 0:
|
||||||
msg = msg + d + "\n"
|
msgs[m] += d + "\n"
|
||||||
else:
|
else:
|
||||||
msg = msg + d + "\t"
|
msgs[m] += d + "\t"
|
||||||
msg += "```"
|
msgs[m] += "```"
|
||||||
|
for msg in msgs:
|
||||||
await self.bot.send_message(ctx.message.author, msg)
|
await self.bot.send_message(ctx.message.author, msg)
|
||||||
|
await asyncio.sleep(1)
|
||||||
else:
|
else:
|
||||||
await self.bot.say("There are no local sound effects.")
|
await self.bot.say("There are no local sound effects.")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user