2022-10-21 23:17:06 +00:00
|
|
|
/*
|
|
|
|
* Vencord, a modification for Discord's desktop app
|
|
|
|
* Copyright (c) 2022 Vendicated and contributors
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2023-05-05 23:36:00 +00:00
|
|
|
import { definePluginSettings } from "@api/Settings";
|
2022-11-28 12:37:55 +00:00
|
|
|
import { Devs } from "@utils/constants";
|
2022-12-15 14:05:44 +00:00
|
|
|
import definePlugin, { OptionType } from "@utils/types";
|
2023-04-09 04:55:04 +00:00
|
|
|
import type { Message } from "discord-types/general";
|
2022-12-15 14:05:44 +00:00
|
|
|
|
2023-04-09 04:55:04 +00:00
|
|
|
const settings = definePluginSettings({
|
2023-05-14 00:01:10 +00:00
|
|
|
userList: {
|
2023-04-09 04:55:04 +00:00
|
|
|
description:
|
2023-05-14 00:01:10 +00:00
|
|
|
"List of users to allow or exempt pings for (separated by commas or spaces)",
|
2023-04-09 04:55:04 +00:00
|
|
|
type: OptionType.STRING,
|
|
|
|
default: "1234567890123445,1234567890123445",
|
|
|
|
},
|
2023-05-14 00:01:10 +00:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2023-04-09 04:55:04 +00:00
|
|
|
inverseShiftReply: {
|
|
|
|
description: "Invert Discord's shift replying behaviour (enable to make shift reply mention user)",
|
|
|
|
type: OptionType.BOOLEAN,
|
|
|
|
default: false,
|
|
|
|
}
|
|
|
|
});
|
2022-10-02 02:08:34 +00:00
|
|
|
|
|
|
|
export default definePlugin({
|
|
|
|
name: "NoReplyMention",
|
|
|
|
description: "Disables reply pings by default",
|
2023-05-14 00:01:10 +00:00
|
|
|
authors: [Devs.DustyAngel47, Devs.axyie, Devs.pylix, Devs.outfoxxed],
|
2023-04-09 04:55:04 +00:00
|
|
|
settings,
|
|
|
|
|
|
|
|
shouldMention(message: Message, isHoldingShift: boolean) {
|
2023-05-14 00:01:10 +00:00
|
|
|
const isListed = settings.store.userList.includes(message.author.id);
|
|
|
|
const isExempt = settings.store.shouldPingListed ? isListed : !isListed;
|
2023-04-09 04:55:04 +00:00
|
|
|
return settings.store.inverseShiftReply ? isHoldingShift !== isExempt : !isHoldingShift && isExempt;
|
2022-12-15 14:05:44 +00:00
|
|
|
},
|
2023-04-09 04:55:04 +00:00
|
|
|
|
2022-10-02 02:08:34 +00:00
|
|
|
patches: [
|
|
|
|
{
|
2023-04-09 04:55:04 +00:00
|
|
|
find: ",\"Message\")}function",
|
2022-10-02 02:08:34 +00:00
|
|
|
replacement: {
|
2023-04-09 04:55:04 +00:00
|
|
|
match: /:(\i),shouldMention:!(\i)\.shiftKey/,
|
|
|
|
replace: ":$1,shouldMention:$self.shouldMention($1,$2.shiftKey)"
|
|
|
|
}
|
|
|
|
}
|
2022-12-15 14:05:44 +00:00
|
|
|
],
|
2022-10-05 22:42:58 +00:00
|
|
|
});
|