Add support for silent pings in notifications (#679)

This commit is contained in:
DjJewl 2026-01-23 19:35:29 -06:00 • committed by GitHub
parent aaf6fa82d6
commit 26d920aa47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -22,6 +22,8 @@ interface IMessageCreate {
message: Message;
}
const SILENT_PING_FLAG = 1 << 12;
function Icon(enabled?: boolean): JSX.Element {
return <svg
width="18"
@ -122,6 +124,11 @@ const settings = definePluginSettings({
description: "Whether the notification sound should be played",
default: true,
},
respectSilentPings: {
type: OptionType.BOOLEAN,
description: "Respect silent pings (@silent / suppress notifications)",
default: true
},
statusToUse: {
type: OptionType.SELECT,
description: "Status to use for whitelist",
@ -161,6 +168,7 @@ export default definePlugin({
if (message.state === "SENDING" || message.content === "" || message.author.id === currentUser.id || (channelId === currentChannelId && WindowStore.isFocused()) || userStatus !== settings.store.statusToUse) {
return;
}
if (settings.store.respectSilentPings && (message.flags & SILENT_PING_FLAG)) {return;}
const mentioned = MessageStore.getMessage(channelId, message.id)?.mentioned;
if ((settings.store.guilds.split(", ").includes(guildId) || settings.store.channels.split(", ").includes(channelId)) && mentioned) {
await showNotification(message, guildId);