Equicord/src/equicordplugins/annamox/index.ts

113 lines
3.4 KiB
TypeScript
Raw Normal View History

2024-04-17 14:29:47 -04:00
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
export const settings = definePluginSettings({
dms: {
type: OptionType.BOOLEAN,
default: true,
description: "Remove shops above DMs list",
restartNeeded: true,
},
billing: {
type: OptionType.BOOLEAN,
default: true,
description: "Remove billing settings",
restartNeeded: true,
},
gift: {
type: OptionType.BOOLEAN,
default: true,
description: "Remove gift button",
restartNeeded: true,
},
2024-07-13 01:30:19 -04:00
emojiList: {
type: OptionType.BOOLEAN,
default: true,
description: "Remove unavailable categories from the emoji picker",
restartNeeded: true,
},
2024-04-17 14:29:47 -04:00
});
export default definePlugin({
name: "Anammox",
2024-07-18 18:14:06 -04:00
description: "Remove Some Discord Settings",
2024-04-17 14:29:47 -04:00
authors: [Devs.Kyuuhachi],
settings,
patches: [
{ // Above DMs, mouse nav
find: 'tutorialId:"direct-messages"',
replacement: [
{
match: /"premium"\)/,
replace: "$&&&undefined",
},
{
match: /"discord-shop"\)/,
replace: "$&&&undefined",
},
],
predicate: () => settings.store.dms,
},
{ // Above DMs, keyboard nav
2024-06-21 20:05:37 -04:00
find: ".hasLibraryApplication()&&!",
2024-04-17 14:29:47 -04:00
replacement: [
{
2024-06-21 20:05:37 -04:00
match: /\i\.\i\.APPLICATION_STORE,/,
2024-04-17 14:29:47 -04:00
replace: "/*$&*/",
},
{
2024-06-21 20:05:37 -04:00
match: /\i\.\i\.COLLECTIBLES_SHOP,/,
2024-04-17 14:29:47 -04:00
replace: "/*$&*/",
},
],
predicate: () => settings.store.dms,
},
{ // Settings, sidebar
find: "Messages.BILLING_SETTINGS",
2024-07-13 01:30:19 -04:00
replacement: [
{
match: /(?<=Messages.BILLING_SETTINGS,)/,
replace: "capitalism:true,"
},
{
match: /\i\?\i:\i\.toSpliced\(3,0,\i\)/,
replace: "($&).filter(e=>!e.capitalism)",
},
],
2024-04-17 14:29:47 -04:00
predicate: () => settings.store.billing,
},
{ // Gift button
find: 'Messages.PREMIUM_GIFT_BUTTON_LABEL,"aria-haspopup":"dialog",onClick:',
replacement: {
2024-08-21 21:53:50 -04:00
match: /if\(\i\)return null;/,
2024-04-17 14:29:47 -04:00
replace: "return null;",
},
predicate: () => settings.store.gift,
2024-07-13 01:30:19 -04:00
},
{ // Emoji list
find: "Messages.EMOJI_PICKER_CREATE_EMOJI_TITLE,size:",
replacement: {
2024-08-21 21:53:50 -04:00
match: /(\i)=\i\|\|!\i&&\i.\i\i.isEmojiCategoryNitroLocked\(\{[^}]*\}\);/,
2024-07-13 01:30:19 -04:00
replace: "$&$1||"
},
predicate: () => settings.store.emojiList,
},
{ // Emoji category list
find: "Messages.EMOJI_CATEGORY_TOP_GUILD_EMOJI.format({",
replacement: {
match: /(?<=(\i)\.unshift\((\i)\):)(?=\1\.push\(\2\))/,
replace: "$2.isNitroLocked||"
},
predicate: () => settings.store.emojiList,
2024-04-17 14:29:47 -04:00
}
],
});