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>
This commit is contained in:
Bruno Krügel 2026-08-05 23:36:07 -03:00 • committed by GitHub
parent f41a74ea17
commit 6307ea7815
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 37 additions and 2 deletions

View file

@ -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);
}
},
});

View file

@ -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;

View file

@ -1410,6 +1410,10 @@ export const EquicordDevs = Object.freeze({
name: "benjas333",
id: 456577284464443394n,
},
k304: {
name: "k304",
id: 255004979637649408n
},
} satisfies Record<string, Dev>);
// iife so #__PURE__ works correctly