add ignore bots

This commit is contained in:
camila314 2023-11-26 08:32:37 -06:00
parent 42b09a3d0b
commit c7ed529a6c

View file

@ -74,7 +74,13 @@ function highlightKeywords(s: string, r: Array<string>) {
} }
const settings = definePluginSettings({ const settings = definePluginSettings({
replace: { ignoreBots: {
type: OptionType.BOOLEAN,
description: "Ignore messages from bots",
default: true
},
keywords: {
type: OptionType.COMPONENT, type: OptionType.COMPONENT,
description: "", description: "",
component: () => { component: () => {
@ -172,6 +178,9 @@ export default definePlugin({
}, },
applyRegexes(m) { applyRegexes(m) {
if (settings.store.ignoreBots && m.author.bot)
return;
if (regexes.some(r => r != "" && safeMatchesRegex(m.content, r))) { if (regexes.some(r => r != "" && safeMatchesRegex(m.content, r))) {
m.mentions.push(this.me); m.mentions.push(this.me);