MessageLogger: Add user ignore list (#1275)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
kb 2023-06-16 19:35:35 +02:00 committed by GitHub
parent a1fabcdf0a
commit 55af40ee74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -147,6 +147,11 @@ export default definePlugin({
type: OptionType.BOOLEAN,
description: "Whether to ignore messages by yourself",
default: false
},
ignoreUsers: {
type: OptionType.STRING,
description: "Comma-separated list of user IDs to ignore",
default: ""
}
},
@ -154,7 +159,7 @@ export default definePlugin({
try {
if (cache == null || (!isBulk && !cache.has(data.id))) return cache;
const { ignoreBots, ignoreSelf } = Settings.plugins.MessageLogger;
const { ignoreBots, ignoreSelf, ignoreUsers } = Settings.plugins.MessageLogger;
const myId = UserStore.getCurrentUser().id;
function mutate(id: string) {
@ -165,7 +170,8 @@ export default definePlugin({
const shouldIgnore = data.mlDeleted ||
(msg.flags & EPHEMERAL) === EPHEMERAL ||
ignoreBots && msg.author?.bot ||
ignoreSelf && msg.author?.id === myId;
ignoreSelf && msg.author?.id === myId ||
ignoreUsers.includes(msg.author?.id);
if (shouldIgnore) {
cache = cache.remove(id);