Fix hiding messages automatically that doesn't contain media

This commit is contained in:
fumiichan 2025-02-02 21:56:52 +09:00
parent 303512ef92
commit d51b2888e0
No known key found for this signature in database
GPG key ID: 75B15A4C2C5A48A6

View file

@ -64,6 +64,10 @@ const toggleHide = async (channelId: string, messageId: string): Promise<void> =
* @returns {boolean}
*/
const shouldHideByUserIdFilter = (payload: IMessage, userFilters: string[]): boolean => {
if (!payload.attachments.length && !payload.embeds.length) {
return false;
}
for (const id of userFilters) {
if (payload.author.id === id) {
return true;
@ -73,6 +77,11 @@ const shouldHideByUserIdFilter = (payload: IMessage, userFilters: string[]): boo
return false;
};
/**
* Checks if the embed should be hidden
* @param {Embed[]} embeds List of embeds
* @param {string[]} domainList List of domains
*/
const shouldHideEmbed = (embeds: Embed[], domainList: string[]): boolean => {
for (const embed of embeds) {
if (!embed.url) {