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)
|
||||
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()
|
||||
m = 0
|
||||
maxm = 1980
|
||||
if files:
|
||||
for i, d in enumerate(files.keys()):
|
||||
if i % 4 == 0 and i != 0:
|
||||
msg = msg + d + "\n"
|
||||
else:
|
||||
msg = msg + d + "\t"
|
||||
msg += "```"
|
||||
await self.bot.send_message(ctx.message.author, msg)
|
||||
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:
|
||||
msgs[m] += d + "\n"
|
||||
else:
|
||||
msgs[m] += d + "\t"
|
||||
msgs[m] += "```"
|
||||
for msg in msgs:
|
||||
await self.bot.send_message(ctx.message.author, msg)
|
||||
await asyncio.sleep(1)
|
||||
else:
|
||||
await self.bot.say("There are no local sound effects.")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user