mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-07 13:43:03 -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,
|
bot: message?.bot || message?.author?.bot,
|
||||||
flags: message?.flags,
|
flags: message?.flags,
|
||||||
ghostPinged,
|
ghostPinged,
|
||||||
isCachedByUs: (message as LoggedMessageJSON).ourCache
|
isCachedByUs: (message as LoggedMessageJSON).ourCache,
|
||||||
|
webhookId: message?.webhookId
|
||||||
})
|
})
|
||||||
) {
|
) {
|
||||||
// Flogger.log("IGNORING", message, payload);
|
// 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: {
|
ignoreSelf: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Whether to ignore messages by yourself",
|
description: "Whether to ignore messages by yourself",
|
||||||
|
|
|
@ -74,6 +74,7 @@ interface ShouldIgnoreArguments {
|
||||||
bot?: boolean;
|
bot?: boolean;
|
||||||
ghostPinged?: boolean;
|
ghostPinged?: boolean;
|
||||||
isCachedByUs?: boolean;
|
isCachedByUs?: boolean;
|
||||||
|
webhookId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EPHEMERAL = 64;
|
const EPHEMERAL = 64;
|
||||||
|
@ -87,7 +88,7 @@ const UserGuildSettingsStore = findStoreLazy("UserGuildSettingsStore");
|
||||||
* @param {ShouldIgnoreArguments} args - An object containing the message details.
|
* @param {ShouldIgnoreArguments} args - An object containing the message details.
|
||||||
* @returns {boolean} - True if the message should be ignored, false if it should be kept.
|
* @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;
|
const isEphemeral = ((flags ?? 0) & EPHEMERAL) === EPHEMERAL;
|
||||||
if (isEphemeral) return true; // ignore
|
if (isEphemeral) return true; // ignore
|
||||||
|
|
||||||
|
@ -96,7 +97,7 @@ export function shouldIgnore({ channelId, authorId, guildId, flags, bot, ghostPi
|
||||||
|
|
||||||
const myId = UserStore.getCurrentUser().id;
|
const myId = UserStore.getCurrentUser().id;
|
||||||
const { ignoreUsers, ignoreChannels, ignoreGuilds } = Settings.plugins.MessageLogger;
|
const { ignoreUsers, ignoreChannels, ignoreGuilds } = Settings.plugins.MessageLogger;
|
||||||
const { ignoreBots, ignoreSelf } = settings.store;
|
const { ignoreBots, ignoreSelf, ignoreWebhooks } = settings.store;
|
||||||
|
|
||||||
if (ignoreSelf && authorId === myId)
|
if (ignoreSelf && authorId === myId)
|
||||||
return true; // ignore
|
return true; // ignore
|
||||||
|
@ -132,6 +133,8 @@ export function shouldIgnore({ channelId, authorId, guildId, flags, bot, ghostPi
|
||||||
|
|
||||||
if ((ignoreBots && bot) && !isAuthorWhitelisted) return true; // ignore
|
if ((ignoreBots && bot) && !isAuthorWhitelisted) return true; // ignore
|
||||||
|
|
||||||
|
if ((ignoreWebhooks && webhookId) && !isAuthorWhitelisted) return true;
|
||||||
|
|
||||||
if (ghostPinged) return false; // keep
|
if (ghostPinged) return false; // keep
|
||||||
|
|
||||||
// author has highest priority
|
// author has highest priority
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue