diff --git a/modules/core/discord/discord_command_handler.py b/modules/core/discord/discord_command_handler.py
index 7d1d7d1..0e13bf1 100644
--- a/modules/core/discord/discord_command_handler.py
+++ b/modules/core/discord/discord_command_handler.py
@@ -57,7 +57,7 @@ class DiscordCommandHandler(BaseModule):
def send_response(self, ctx: Message, reply):
rsp = ""
- embeds = []
+ embeds: Embed = None
if type(reply) == str:
reply = self.discord.text.format_message(reply)
rsp = f"> {self.parseDiscord(reply)}"
@@ -68,22 +68,34 @@ class DiscordCommandHandler(BaseModule):
reply, reply)
if type(reply) == ChatBlob:
if reply.embed:
- embeds.append(Embed(title=self.parseDiscord(f"{reply.page_prefix} {reply.title} {reply.page_postfix}"),
+ embeds = Embed(title=self.parseDiscord(f"{reply.page_prefix} {reply.title} {reply.page_postfix}"),
color=0x00FF00,
- description=self.parseDiscord(reply.msg).replace("\n> ", '\n')))
+ description=self.parseDiscord(reply.msg, blob=True))
else:
reply: ChatBlob
rsp = self.parseDiscord(reply.page_prefix) + "\n"
if not (self.discord.text.strip_html_tags(reply.msg) or reply.msg).startswith(reply.title):
rsp += f"**__{reply.title}__**\n"
- rsp += "> " + self.parseDiscord(reply.msg)
+ rsp += self.parseDiscord(reply.msg, blob=True)
rsp += f"\n {self.parseDiscord(reply.page_postfix)}"
self.discord.relay_hub_service.send_message(f"Discord_({ctx.channel.name})",
DictObject({'char_id': 0, 'name': ctx.author.name,
'discord_handle':
f'{ctx.author.name}#{ctx.author.discriminator}'}),
reply, reply)
+ if embeds:
+ if len(embeds.description) > 4000:
+ body = self.discord.text.split_by_separators(embeds.description, 4000, 10)
+ tmp1 = embeds
+ embeds = []
+ for x in enumerate(body):
+ tmp = tmp1.copy()
+ tmp.description = body[x]
+ tmp.title += f"*Page ({x}/{len(body)}*"
+ embeds.append(tmp)
+ else:
+ embeds = [embeds]
if len(rsp) > 2000:
rsp = self.discord.text.split_by_separators(rsp, 2000)
for page in rsp:
@@ -91,7 +103,7 @@ class DiscordCommandHandler(BaseModule):
else:
self.discord.client.loop.create_task(ctx.reply(rsp, embeds=embeds))
- def parseDiscord(self, ctx: str):
+ def parseDiscord(self, ctx: str, blob=False):
proficon = {1: "sold", 2: "ma", 3: "eng", 4: "fixer", 5: "agent", 6: "adv", 7: "trad", 8: "crat", 9: "enf",
10: "doc", 11: "nt", 12: "mp", 14: "keep", 15: "shade"}
m = re.findall(r"", ctx)
@@ -101,7 +113,7 @@ class DiscordCommandHandler(BaseModule):
for x in ["`", ' *', ' _', ' |']:
ctx = ctx.replace(x, f' \\{x.strip()}')
- for pattern, sub in [(r"(
|\n|)", r"\n> "),
+ for pattern, sub in [(r"(
|\n|)", r"\n"),
(r"