From c29362ca8972017ad4074586a3bc061a1f79e71b Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sun, 22 Sep 2024 15:52:25 -0300 Subject: [PATCH 1/4] FullSearchContext: Re-add Copy Author ID --- src/api/ContextMenu.ts | 11 ++++---- src/plugins/fullSearchContext/index.tsx | 35 ++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/api/ContextMenu.ts b/src/api/ContextMenu.ts index fdd4facf..fd8c7e10 100644 --- a/src/api/ContextMenu.ts +++ b/src/api/ContextMenu.ts @@ -90,19 +90,20 @@ export function removeGlobalContextMenuPatch(patch: GlobalContextMenuPatchCallba * A helper function for finding the children array of a group nested inside a context menu based on the id(s) of its children * @param id The id of the child. If an array is specified, all ids will be tried * @param children The context menu children + * @param matchSubstring Whether to check if the id is a substring of the child id */ -export function findGroupChildrenByChildId(id: string | string[], children: Array): Array | null { +export function findGroupChildrenByChildId(id: string | string[], children: Array, matchSubstring = false): Array | null { for (const child of children) { if (child == null) continue; if (Array.isArray(child)) { - const found = findGroupChildrenByChildId(id, child); + const found = findGroupChildrenByChildId(id, child, matchSubstring); if (found !== null) return found; } if ( - (Array.isArray(id) && id.some(id => child.props?.id === id)) - || child.props?.id === id + (Array.isArray(id) && id.some(id => matchSubstring ? child.props?.id?.includes(id) : child.props?.id === id)) + || matchSubstring ? child.props?.id?.includes(id) : child.props?.id === id ) return children; let nextChildren = child.props?.children; @@ -112,7 +113,7 @@ export function findGroupChildrenByChildId(id: string | string[], children: Arra child.props.children = nextChildren; } - const found = findGroupChildrenByChildId(id, nextChildren); + const found = findGroupChildrenByChildId(id, nextChildren, matchSubstring); if (found !== null) return found; } } diff --git a/src/plugins/fullSearchContext/index.tsx b/src/plugins/fullSearchContext/index.tsx index 158612c6..193e69f1 100644 --- a/src/plugins/fullSearchContext/index.tsx +++ b/src/plugins/fullSearchContext/index.tsx @@ -16,16 +16,25 @@ * along with this program. If not, see . */ +import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; import { migratePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; +import { NoopComponent } from "@utils/react"; import definePlugin from "@utils/types"; -import { findByPropsLazy } from "@webpack"; +import { filters, findByPropsLazy, waitFor } from "@webpack"; import { ChannelStore, ContextMenuApi, i18n, UserStore } from "@webpack/common"; import { Message } from "discord-types/general"; -import type { MouseEvent } from "react"; const { useMessageMenu } = findByPropsLazy("useMessageMenu"); +interface CopyIdMenuItemProps { + id: string; + label: string; +} + +let CopyIdMenuItem: (props: CopyIdMenuItemProps) => React.ReactElement | null = NoopComponent; +waitFor(filters.componentByCode('"devmode-copy-id-".concat'), m => CopyIdMenuItem = m); + function MessageMenu({ message, channel, onHeightUpdate }) { const canReport = message.author && !(message.author.id === UserStore.getCurrentUser().id || message.author.system); @@ -48,9 +57,25 @@ function MessageMenu({ message, channel, onHeightUpdate }) { itemSrc: void 0, itemSafeSrc: void 0, itemTextContent: void 0, + + isFullSearchContextMenu: true }); } +interface MessageActionsProps { + message: Message; + isFullSearchContextMenu?: boolean; +} + +const contextMenuPatch: NavContextMenuPatchCallback = (children, props: MessageActionsProps) => { + if (props?.isFullSearchContextMenu == null) return; + + const group = findGroupChildrenByChildId("devmode-copy-id", children, true); + group?.push( + CopyIdMenuItem({ id: props.message.author.id, label: i18n.Messages.COPY_ID_AUTHOR }) + ); +}; + migratePluginSettings("FullSearchContext", "SearchReply"); export default definePlugin({ name: "FullSearchContext", @@ -65,7 +90,7 @@ export default definePlugin({ } }], - handleContextMenu(event: MouseEvent, message: Message) { + handleContextMenu(event: React.MouseEvent, message: Message) { const channel = ChannelStore.getChannel(message.channel_id); if (!channel) return; @@ -78,5 +103,9 @@ export default definePlugin({ onHeightUpdate={contextMenuProps.onHeightUpdate} /> ); + }, + + contextMenus: { + "message-actions": contextMenuPatch } }); From d7cbe270e56773997c825513712b899b29bda214 Mon Sep 17 00:00:00 2001 From: sadan4 <117494111+sadan4@users.noreply.github.com> Date: Mon, 23 Sep 2024 02:07:01 -0400 Subject: [PATCH 2/4] FakeNitro: Fix wrongfully allowed emojis in voice calls (#2901) --- src/plugins/fakeNitro/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index efc19495..2a7a0ee7 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -203,6 +203,15 @@ export default definePlugin({ settings, patches: [ + // Patch the emoji picker in voice calls to not be bypassed by fake nitro + { + find: "emojiItemDisabled]", + predicate: () => settings.store.enableEmojiBypass, + replacement: { + match: /CHAT/, + replace: "STATUS" + } + }, { find: ".PREMIUM_LOCKED;", group: true, From 5881716c573c09657d8028e55a4cd04dead24582 Mon Sep 17 00:00:00 2001 From: lewisakura Date: Mon, 23 Sep 2024 07:11:34 +0100 Subject: [PATCH 3/4] RoleColorEverywhere: Fix unneeded restart on setting change (#2899) --- src/plugins/roleColorEverywhere/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index c9ededc5..108ed00c 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -61,8 +61,7 @@ const settings = definePluginSettings({ type: OptionType.SLIDER, description: "Intensity of message coloring.", markers: makeRange(0, 100, 10), - default: 30, - restartNeeded: true + default: 30 }, }); From eb63a54fa64669981c8be4beab81e5a3c478352f Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:07:19 -0300 Subject: [PATCH 4/4] UserVoiceShow: Fix incorrect dependencies --- src/plugins/userVoiceShow/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/userVoiceShow/index.tsx b/src/plugins/userVoiceShow/index.tsx index 98386a16..07b18c27 100644 --- a/src/plugins/userVoiceShow/index.tsx +++ b/src/plugins/userVoiceShow/index.tsx @@ -51,6 +51,7 @@ export default definePlugin({ name: "UserVoiceShow", description: "Shows an indicator when a user is in a Voice Channel", authors: [Devs.Nuckyz, Devs.LordElias], + dependencies: ["MemberListDecoratorsAPI", "MessageDecorationsAPI"], settings, patches: [