From c92849c1b0885fc7a41b0809f3c106c70a9a1347 Mon Sep 17 00:00:00 2001 From: almeidx Date: Sat, 25 Sep 2021 15:38:41 +0100 Subject: [PATCH] clean up --- backend/src/plugins/Utility/commands/RolesCmd.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/src/plugins/Utility/commands/RolesCmd.ts b/backend/src/plugins/Utility/commands/RolesCmd.ts index 04384393..86c09554 100644 --- a/backend/src/plugins/Utility/commands/RolesCmd.ts +++ b/backend/src/plugins/Utility/commands/RolesCmd.ts @@ -58,7 +58,7 @@ export const RolesCmd = utilityCmd({ if (sort === "position" || sort === "order") { roles.sort(sorter("position", sortDir)); } else if (sort === "memberCount" && args.counts) { - roles.sort((first, second) => (roleCounts!.get(second.id) ?? 0) - (roleCounts!.get(first.id) ?? 0)); + roles.sort((first, second) => roleCounts!.get(second.id)! - roleCounts!.get(first.id)!); } else if (sort === "name") { roles.sort(sorter((r) => r.name.toLowerCase(), sortDir)); } else { @@ -80,15 +80,16 @@ export const RolesCmd = utilityCmd({ return line; }); + const codeBlock = "```py\n" + roleLines.join("\n") + "```"; if (i === 0) { msg.channel.send( trimLines(` ${args.search ? "Total roles found" : "Total roles"}: ${roles.length} - \`\`\`py\n${roleLines.join("\n")}\`\`\` + ${codeBlock} `), ); } else { - msg.channel.send("```py\n" + roleLines.join("\n") + "```"); + msg.channel.send(codeBlock); } } },