MsgClickActions: control ping via shift & NoReplyMention plugin (#2390)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
sunnie 2024-05-03 23:00:42 +03:00 committed by GitHub
parent 1af44b25f3
commit 78183eb226
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,7 +17,7 @@
*/ */
import { addClickListener, removeClickListener } from "@api/MessageEvents"; import { addClickListener, removeClickListener } from "@api/MessageEvents";
import { definePluginSettings, Settings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
@ -84,11 +84,17 @@ export default definePlugin({
const EPHEMERAL = 64; const EPHEMERAL = 64;
if (msg.hasFlag(EPHEMERAL)) return; if (msg.hasFlag(EPHEMERAL)) return;
const isShiftPress = event.shiftKey && !settings.store.requireModifier;
const NoReplyMention = Vencord.Plugins.plugins.NoReplyMention as any as typeof import("../noReplyMention").default;
const shouldMention = Vencord.Plugins.isPluginEnabled("NoReplyMention")
? NoReplyMention.shouldMention(msg, isShiftPress)
: !isShiftPress;
FluxDispatcher.dispatch({ FluxDispatcher.dispatch({
type: "CREATE_PENDING_REPLY", type: "CREATE_PENDING_REPLY",
channel, channel,
message: msg, message: msg,
shouldMention: !Settings.plugins.NoReplyMention.enabled, shouldMention,
showMentionToggle: channel.guild_id !== null showMentionToggle: channel.guild_id !== null
}); });
} }