From 9bf77cf1dbf271b3337d6621fdcaf6d438f3c870 Mon Sep 17 00:00:00 2001 From: Grzesiek11 Date: Tue, 25 Jun 2024 19:27:13 +0200 Subject: [PATCH] Add an option to enable colors in the member list --- src/plugins/fixCodeblockGap/README.md | 9 +++++++++ src/plugins/ircColors/index.ts | 21 +++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 src/plugins/fixCodeblockGap/README.md diff --git a/src/plugins/fixCodeblockGap/README.md b/src/plugins/fixCodeblockGap/README.md new file mode 100644 index 0000000000..c605451258 --- /dev/null +++ b/src/plugins/fixCodeblockGap/README.md @@ -0,0 +1,9 @@ +# FixCodeblockGap + +Removes the gap between codeblocks and text below it + +![Message with a codeblock on vanilla Discord]() +![Message with a codeblock with FixCodeblockGap]() + +Fixes an annoying Discord bug causing codeblocks to always have a gap between +them and the following text. diff --git a/src/plugins/ircColors/index.ts b/src/plugins/ircColors/index.ts index f900897e32..23a6902eca 100644 --- a/src/plugins/ircColors/index.ts +++ b/src/plugins/ircColors/index.ts @@ -53,6 +53,12 @@ const settings = definePluginSettings({ type: OptionType.NUMBER, default: 70, }, + memberListColors: { + description: "Replace role colors in the member list", + restartNeeded: true, + type: OptionType.BOOLEAN, + default: false, + }, }); export default definePlugin({ @@ -64,12 +70,23 @@ export default definePlugin({ find: "=\"SYSTEM_TAG\"", replacement: { match: /(?<=className:\i\.username,style:.{0,50}:void 0,)/, - replace: "style:{color:$self.calculateNameColorForContext(arguments[0])}," + replace: "style:{color:$self.calculateNameColorForMessageContext(arguments[0])},", }, }, + { + find: ".NameWithRole,{roleName:", + replacement: { + match: /(?<=color:)null!=.{0,50}?(?=,)/, + replace: "$self.calculateNameColorForListContext(arguments[0])", + }, + predicate: () => settings.store.memberListColors, + }, ], settings, - calculateNameColorForContext(context: any) { + calculateNameColorForMessageContext(context: any) { return calculateNameColorForUser(BigInt(context.message.author.id)); }, + calculateNameColorForListContext(context: any) { + return calculateNameColorForUser(BigInt(context.user.id)); + }, });