mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-07 05:42:55 -04:00
This commit is contained in:
parent
7a74182add
commit
2aae71abf7
3 changed files with 13 additions and 3 deletions
|
@ -78,7 +78,8 @@ async function messageDeleteHandler(payload: MessageDeletePayload & { isBulk: bo
|
|||
bot: message?.bot || message?.author?.bot,
|
||||
flags: message?.flags,
|
||||
ghostPinged,
|
||||
isCachedByUs: (message as LoggedMessageJSON).ourCache
|
||||
isCachedByUs: (message as LoggedMessageJSON).ourCache,
|
||||
webhookId: message?.webhookId
|
||||
})
|
||||
) {
|
||||
// Flogger.log("IGNORING", message, payload);
|
||||
|
|
|
@ -52,6 +52,12 @@ export const settings = definePluginSettings({
|
|||
}
|
||||
},
|
||||
|
||||
ignoreWebhooks: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Whether to ignore messages by webhooks",
|
||||
default: false,
|
||||
},
|
||||
|
||||
ignoreSelf: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Whether to ignore messages by yourself",
|
||||
|
|
|
@ -74,6 +74,7 @@ interface ShouldIgnoreArguments {
|
|||
bot?: boolean;
|
||||
ghostPinged?: boolean;
|
||||
isCachedByUs?: boolean;
|
||||
webhookId?: string;
|
||||
}
|
||||
|
||||
const EPHEMERAL = 64;
|
||||
|
@ -87,7 +88,7 @@ const UserGuildSettingsStore = findStoreLazy("UserGuildSettingsStore");
|
|||
* @param {ShouldIgnoreArguments} args - An object containing the message details.
|
||||
* @returns {boolean} - True if the message should be ignored, false if it should be kept.
|
||||
*/
|
||||
export function shouldIgnore({ channelId, authorId, guildId, flags, bot, ghostPinged, isCachedByUs }: ShouldIgnoreArguments): boolean {
|
||||
export function shouldIgnore({ channelId, authorId, guildId, flags, bot, ghostPinged, isCachedByUs, webhookId }: ShouldIgnoreArguments): boolean {
|
||||
const isEphemeral = ((flags ?? 0) & EPHEMERAL) === EPHEMERAL;
|
||||
if (isEphemeral) return true; // ignore
|
||||
|
||||
|
@ -96,7 +97,7 @@ export function shouldIgnore({ channelId, authorId, guildId, flags, bot, ghostPi
|
|||
|
||||
const myId = UserStore.getCurrentUser().id;
|
||||
const { ignoreUsers, ignoreChannels, ignoreGuilds } = Settings.plugins.MessageLogger;
|
||||
const { ignoreBots, ignoreSelf } = settings.store;
|
||||
const { ignoreBots, ignoreSelf, ignoreWebhooks } = settings.store;
|
||||
|
||||
if (ignoreSelf && authorId === myId)
|
||||
return true; // ignore
|
||||
|
@ -132,6 +133,8 @@ export function shouldIgnore({ channelId, authorId, guildId, flags, bot, ghostPi
|
|||
|
||||
if ((ignoreBots && bot) && !isAuthorWhitelisted) return true; // ignore
|
||||
|
||||
if ((ignoreWebhooks && webhookId) && !isAuthorWhitelisted) return true;
|
||||
|
||||
if (ghostPinged) return false; // keep
|
||||
|
||||
// author has highest priority
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue