From 9161121b4ebd4b1ad354579db0ff6264429b9939 Mon Sep 17 00:00:00 2001 From: WiViW Date: Sun, 6 Mar 2022 20:17:53 -0600 Subject: [PATCH] A New "raw" list feature for CannedReply, I've not tested the code, but theoretically it should work lol --- structure/commands/CannedReply.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/structure/commands/CannedReply.js b/structure/commands/CannedReply.js index 9c56316..ea6e42d 100644 --- a/structure/commands/CannedReply.js +++ b/structure/commands/CannedReply.js @@ -25,17 +25,27 @@ class CannedReply extends Command { } else if ([ 'create', 'delete' ].includes(op)) { return this.createCanned(op, args, message); } else if ([ 'list' ].includes(first.toLowerCase(op))) { - const list = Object.entries(this.client.modmail.replies); let str = ''; // eslint-disable-next-line no-shadow - for (const [ name, content ] of list) { - const substr = `**${name}:** ${content}\n`; - if (str.length + substr.length > 2000) { - await channel.send(str); - str = ''; + if ([ 'raw' ].includes(first.toLowerCase(op))) { + for (const [ name, content ] of list) { + const substr = `**${name}:** \`${content}\`\n`; + if (str.length + substr.length > 2000) { + await channel.send(str); + str = ''; + } + str += substr; + } + } else{ + for (const [ name, content ] of list) { + const substr = `**${name}:** ${content}\n`; + if (str.length + substr.length > 2000) { + await channel.send(str); + str = ''; + } + str += substr; } - str += substr; } if (str.length) return channel.send(str); return '**__None__**';