NoReplyMention: add option to only exclude specific users from pings (#1107)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
outfoxxed 2023-05-13 17:01:10 -07:00 committed by GitHub
parent 7a27de8927
commit caf77a3d7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 5 deletions

@ -22,12 +22,27 @@ import definePlugin, { OptionType } from "@utils/types";
import type { Message } from "discord-types/general"; import type { Message } from "discord-types/general";
const settings = definePluginSettings({ const settings = definePluginSettings({
exemptList: { userList: {
description: description:
"List of users to exempt from this plugin (separated by commas or spaces)", "List of users to allow or exempt pings for (separated by commas or spaces)",
type: OptionType.STRING, type: OptionType.STRING,
default: "1234567890123445,1234567890123445", default: "1234567890123445,1234567890123445",
}, },
shouldPingListed: {
description: "Behaviour",
type: OptionType.SELECT,
options: [
{
label: "Do not ping the listed users",
value: false,
},
{
label: "Only ping the listed users",
value: true,
default: true,
},
],
},
inverseShiftReply: { inverseShiftReply: {
description: "Invert Discord's shift replying behaviour (enable to make shift reply mention user)", description: "Invert Discord's shift replying behaviour (enable to make shift reply mention user)",
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
@ -38,11 +53,12 @@ const settings = definePluginSettings({
export default definePlugin({ export default definePlugin({
name: "NoReplyMention", name: "NoReplyMention",
description: "Disables reply pings by default", description: "Disables reply pings by default",
authors: [Devs.DustyAngel47, Devs.axyie, Devs.pylix], authors: [Devs.DustyAngel47, Devs.axyie, Devs.pylix, Devs.outfoxxed],
settings, settings,
shouldMention(message: Message, isHoldingShift: boolean) { shouldMention(message: Message, isHoldingShift: boolean) {
const isExempt = settings.store.exemptList.includes(message.author.id); const isListed = settings.store.userList.includes(message.author.id);
const isExempt = settings.store.shouldPingListed ? isListed : !isListed;
return settings.store.inverseShiftReply ? isHoldingShift !== isExempt : !isHoldingShift && isExempt; return settings.store.inverseShiftReply ? isHoldingShift !== isExempt : !isHoldingShift && isExempt;
}, },

@ -290,5 +290,9 @@ export const Devs = /* #__PURE__*/ Object.freeze({
CatNoir: { CatNoir: {
name: "CatNoir", name: "CatNoir",
id: 260371016348336128n id: 260371016348336128n
} },
outfoxxed: {
name: "outfoxxed",
id: 837425748435796060n
},
}); });