Support for over 2k characters in CCs list

This commit is contained in:
Twentysix 2016-03-29 00:06:14 +02:00
parent 15fc9db1c6
commit cab5b23b0b

View File

@ -95,11 +95,18 @@ class CustomCommands:
if server.id in self.c_commands: if server.id in self.c_commands:
cmdlist = self.c_commands[server.id] cmdlist = self.c_commands[server.id]
if cmdlist: if cmdlist:
msg = "```Custom commands:\n" i = 0
msg = ["```Custom commands:\n"]
for cmd in sorted([cmd for cmd in cmdlist.keys()]): for cmd in sorted([cmd for cmd in cmdlist.keys()]):
msg += " {}{}\n".format(ctx.prefix, cmd) if len(msg[i]) + len(ctx.prefix) + len(cmd) + 5 > 2000:
fmsg = msg + "```" msg[i] += "```"
await self.bot.whisper(fmsg) i += 1
msg.append("``` {}{}\n".format(ctx.prefix, cmd))
else:
msg[i] += " {}{}\n".format(ctx.prefix, cmd)
msg[i] += "```"
for cmds in msg:
await self.bot.whisper(cmds)
else: else:
await self.bot.say("There are no custom commands in this server. Use addcom [command] [text]") await self.bot.say("There are no custom commands in this server. Use addcom [command] [text]")
else: else: