MessageLogger: Add user ignore list (#1275)
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
parent
a1fabcdf0a
commit
55af40ee74
1 changed files with 8 additions and 2 deletions
|
@ -147,6 +147,11 @@ export default definePlugin({
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: "Whether to ignore messages by yourself",
|
description: "Whether to ignore messages by yourself",
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
ignoreUsers: {
|
||||||
|
type: OptionType.STRING,
|
||||||
|
description: "Comma-separated list of user IDs to ignore",
|
||||||
|
default: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -154,7 +159,7 @@ export default definePlugin({
|
||||||
try {
|
try {
|
||||||
if (cache == null || (!isBulk && !cache.has(data.id))) return cache;
|
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;
|
const myId = UserStore.getCurrentUser().id;
|
||||||
|
|
||||||
function mutate(id: string) {
|
function mutate(id: string) {
|
||||||
|
@ -165,7 +170,8 @@ export default definePlugin({
|
||||||
const shouldIgnore = data.mlDeleted ||
|
const shouldIgnore = data.mlDeleted ||
|
||||||
(msg.flags & EPHEMERAL) === EPHEMERAL ||
|
(msg.flags & EPHEMERAL) === EPHEMERAL ||
|
||||||
ignoreBots && msg.author?.bot ||
|
ignoreBots && msg.author?.bot ||
|
||||||
ignoreSelf && msg.author?.id === myId;
|
ignoreSelf && msg.author?.id === myId ||
|
||||||
|
ignoreUsers.includes(msg.author?.id);
|
||||||
|
|
||||||
if (shouldIgnore) {
|
if (shouldIgnore) {
|
||||||
cache = cache.remove(id);
|
cache = cache.remove(id);
|
||||||
|
|
Loading…
Reference in a new issue