From 6307ea7815794ac79d5d716973c2059d92bdf31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Kr=C3=BCgel?= Date: Wed, 5 Aug 2026 23:36:07 -0300 Subject: [PATCH] Add AutoJumpToMessage plugin (#1293) * Add autoJumpToMessage plugin * fix(autoJumpToMessage): remove duplicated author * legal(autoJumpToMessage): add copyright header * chore(autoJumpToMessage): remove debug logs * autojumptomessage fixes & actually ignore muted * Update index.ts --------- Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com> --- .../autoJumpToMessage/index.ts | 33 +++++++++++++++++++ .../pingNotifications/index.tsx | 2 -- src/utils/constants.ts | 4 +++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 src/equicordplugins/autoJumpToMessage/index.ts diff --git a/src/equicordplugins/autoJumpToMessage/index.ts b/src/equicordplugins/autoJumpToMessage/index.ts new file mode 100644 index 000000000..f0c052ffb --- /dev/null +++ b/src/equicordplugins/autoJumpToMessage/index.ts @@ -0,0 +1,33 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2026 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { definePluginSettings } from "@api/Settings"; +import { EquicordDevs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { ChannelRouter, ChannelStore, UserGuildSettingsStore } from "@webpack/common"; + +const settings = definePluginSettings({ + onlyWhenUnfocused: { + type: OptionType.BOOLEAN, + default: true, + description: "Only automatically jump to messages when Discord's window is unfocused.", + }, +}); + +export default definePlugin({ + name: "AutoJumpToMessage", + description: "Automatically opens the channel from new messages.", + tags: ["Chat", "Utility"], + authors: [EquicordDevs.k304], + settings, + flux: { + RPC_NOTIFICATION_CREATE({ channelId }) { + if (!channelId || settings.store.onlyWhenUnfocused && document.hasFocus() + || UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(ChannelStore.getChannel(channelId)?.guild_id, channelId)) return; + ChannelRouter.transitionToChannel(channelId); + } + }, +}); diff --git a/src/equicordplugins/pingNotifications/index.tsx b/src/equicordplugins/pingNotifications/index.tsx index 5479d3eed..9b4545d5e 100644 --- a/src/equicordplugins/pingNotifications/index.tsx +++ b/src/equicordplugins/pingNotifications/index.tsx @@ -10,7 +10,6 @@ import { EquicordDevs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { ChannelStore, - GuildStore, NavigationRouter, PresenceStore, RelationshipStore, @@ -70,7 +69,6 @@ function checkIfMuted(channel) { } if (channel.guild_id) { - const guild = GuildStore.getGuild(channel.guild_id); if (UserGuildSettingsStore.isMuted(channel.guild_id)) return true; if (UserGuildSettingsStore.isMuted(channel.guild_id)) return true; diff --git a/src/utils/constants.ts b/src/utils/constants.ts index c9e0c95d7..b5eb50978 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -1410,6 +1410,10 @@ export const EquicordDevs = Object.freeze({ name: "benjas333", id: 456577284464443394n, }, + k304: { + name: "k304", + id: 255004979637649408n + }, } satisfies Record); // iife so #__PURE__ works correctly