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:
parent
f41a74ea17
commit
6307ea7815
3 changed files with 37 additions and 2 deletions
33
src/equicordplugins/autoJumpToMessage/index.ts
Normal file
33
src/equicordplugins/autoJumpToMessage/index.ts
Normal 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);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue