Plugins: Fix Multiple Bugs
This commit is contained in:
parent
67e7145e7e
commit
64080b1b68
4 changed files with 65 additions and 33 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* Copyright (c) 2025 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
|
|
@ -15,6 +15,12 @@ export const settings = definePluginSettings({
|
|||
description: "Remove shops above DMs list",
|
||||
restartNeeded: true,
|
||||
},
|
||||
serverBoost: {
|
||||
type: OptionType.BOOLEAN,
|
||||
default: true,
|
||||
description: "Remove server boost info above channel list",
|
||||
restartNeeded: true,
|
||||
},
|
||||
billing: {
|
||||
type: OptionType.BOOLEAN,
|
||||
default: true,
|
||||
|
|
@ -27,6 +33,12 @@ export const settings = definePluginSettings({
|
|||
description: "Remove gift button",
|
||||
restartNeeded: true,
|
||||
},
|
||||
gif: {
|
||||
type: OptionType.BOOLEAN,
|
||||
default: false,
|
||||
description: "Remove gif and sticker buttons",
|
||||
restartNeeded: true,
|
||||
},
|
||||
emojiList: {
|
||||
type: OptionType.BOOLEAN,
|
||||
default: true,
|
||||
|
|
@ -72,12 +84,21 @@ export default definePlugin({
|
|||
],
|
||||
predicate: () => settings.store.dms,
|
||||
},
|
||||
{
|
||||
// Channel list server boost progress bar
|
||||
find: "useGuildActionRow",
|
||||
replacement: {
|
||||
match: /\i\.premiumProgressBarEnabled&&[^,]+/,
|
||||
replace: "null"
|
||||
},
|
||||
predicate: () => settings.store.serverBoost,
|
||||
},
|
||||
{
|
||||
// Settings, sidebar
|
||||
find: "#{intl::BILLING_SETTINGS}",
|
||||
replacement: [
|
||||
{
|
||||
match: /(?<=#{intl::BILLING_SETTINGS}\),)/,
|
||||
match: /(?<=#{intl::BILLING_SETTINGS}[^,]*?,)(?=div)/,
|
||||
replace: "capitalism:true,"
|
||||
},
|
||||
{
|
||||
|
|
@ -89,20 +110,25 @@ export default definePlugin({
|
|||
},
|
||||
{
|
||||
// Gift button
|
||||
find: "GIFT_BUTTON)",
|
||||
replacement: {
|
||||
match: /if\(\i\)return null;/,
|
||||
replace: "return null;",
|
||||
},
|
||||
all: true,
|
||||
find: '"sticker")',
|
||||
replacement: { match: /&&\i\.push\(\([^&]*?,"gift"\)\)/, replace: "", },
|
||||
predicate: () => settings.store.gift,
|
||||
},
|
||||
{
|
||||
// Gif and sticker buttons
|
||||
find: '"sticker")',
|
||||
replacement: [
|
||||
{ match: /&&\i\.push\([^&]*?,"gif"\)\)/, replace: "", },
|
||||
{ match: /&&\i\.push\([^&]*?,"sticker"\)\)/, replace: "", },
|
||||
],
|
||||
predicate: () => settings.store.gif,
|
||||
},
|
||||
{
|
||||
// Emoji list
|
||||
find: "#{intl::EMOJI_PICKER_CREATE_EMOJI_TITLE}),size:",
|
||||
replacement: {
|
||||
match: /(\i)=\i\|\|!\i&&\i.\i.isEmojiCategoryNitroLocked\(\{[^}]*\}\);/,
|
||||
replace: "$&$1=($1 && $1.isNitroLocked && !$1.isUserAccess);"
|
||||
replace: "$&$1||"
|
||||
},
|
||||
predicate: () => settings.store.emojiList,
|
||||
},
|
||||
|
|
@ -111,7 +137,7 @@ export default definePlugin({
|
|||
find: "#{intl::EMOJI_CATEGORY_TOP_GUILD_EMOJI},{guildName:",
|
||||
replacement: {
|
||||
match: /(?<=(\i)\.unshift\((\i)\):)(?=\1\.push\(\2\))/,
|
||||
replace: "$2.isNitroLocked && !$2.isUserAccess ||"
|
||||
replace: "$2.isNitroLocked||"
|
||||
},
|
||||
predicate: () => settings.store.emojiList,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { addMessagePreSendListener } from "@api/MessageEvents";
|
||||
import { addMessagePreSendListener, removeMessagePreSendListener } from "@api/MessageEvents";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { Alerts, ChannelStore, Forms, PermissionsBits, PermissionStore } from "@webpack/common";
|
||||
|
|
@ -35,29 +35,35 @@ function warningEmbedNotice(trigger) {
|
|||
});
|
||||
}
|
||||
|
||||
const handleMessage = async (channelId, messageObj) => {
|
||||
const channel = ChannelStore.getChannel(channelId);
|
||||
if (channel.isDM()) return { cancel: false };
|
||||
if (PermissionStore.can(PermissionsBits.ADMINISTRATOR, channel) || PermissionStore.can(PermissionsBits.MANAGE_GUILD, channel)) return { cancel: false };
|
||||
|
||||
const escapedStrings = filterList.map(escapeRegex);
|
||||
const regexString = escapedStrings.join("|");
|
||||
const regex = new RegExp(`(${regexString})`, "i");
|
||||
|
||||
const matches = regex.exec(messageObj.content);
|
||||
console.log(matches);
|
||||
if (matches) {
|
||||
if (!await warningEmbedNotice(matches[0])) {
|
||||
return { cancel: true };
|
||||
}
|
||||
}
|
||||
|
||||
return { cancel: false };
|
||||
};
|
||||
|
||||
export default definePlugin({
|
||||
name: "DontFilterMe",
|
||||
description: "Warns you if your message contains a term in the automod preset list",
|
||||
authors: [Devs.Samwich],
|
||||
dependencies: ["MessageEventsAPI"],
|
||||
start() {
|
||||
this.preSend = addMessagePreSendListener(async (channelId, messageObj) => {
|
||||
const channel = ChannelStore.getChannel(channelId);
|
||||
if (channel.isDM()) return { cancel: false };
|
||||
if (PermissionStore.can(PermissionsBits.ADMINISTRATOR, channel) || PermissionStore.can(PermissionsBits.MANAGE_GUILD, channel)) return { cancel: false };
|
||||
|
||||
const escapedStrings = filterList.map(escapeRegex);
|
||||
const regexString = escapedStrings.join("|");
|
||||
const regex = new RegExp(`(${regexString})`, "i");
|
||||
|
||||
const matches = regex.exec(messageObj.content);
|
||||
if (matches) {
|
||||
if (!await warningEmbedNotice(matches[0])) {
|
||||
return { cancel: true };
|
||||
}
|
||||
}
|
||||
|
||||
return { cancel: false };
|
||||
});
|
||||
addMessagePreSendListener(handleMessage);
|
||||
},
|
||||
stop() {
|
||||
removeMessagePreSendListener(handleMessage);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { deleteCacheFromDataStore, DeleteEntireStore, saveCacheToDataStore } fro
|
|||
export const noteHandlerCache = new Map();
|
||||
|
||||
export default new (class NoteHandler {
|
||||
public _formatNote(channel: Channel, message: Message): HolyNotes.Note {
|
||||
private _formatNote(channel: Channel, message: Message): HolyNotes.Note {
|
||||
return {
|
||||
id: message.id,
|
||||
channel_id: message.channel_id,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import noteHandler from "../../NoteHandler";
|
|||
import { downloadNotes, uploadNotes } from "../../utils";
|
||||
|
||||
export default ({ onClose, ...modalProps }: ModalProps & { onClose: () => void; }) => {
|
||||
const { colorStatusGreen } = findByProps("colorStatusGreen");
|
||||
const { statusTagGreen } = findByProps("statusTagGreen");
|
||||
|
||||
return (
|
||||
<ModalRoot {...modalProps} className="vc-help-modal" size={ModalSize.MEDIUM}>
|
||||
|
|
@ -28,7 +28,7 @@ export default ({ onClose, ...modalProps }: ModalProps & { onClose: () => void;
|
|||
<br />
|
||||
the button with the notebook name you would like to note the message to.
|
||||
<br />
|
||||
<span style={{ fontWeight: "bold" }} className={colorStatusGreen}>
|
||||
<span style={{ fontWeight: "bold" }} className={statusTagGreen}>
|
||||
Protip:
|
||||
</span>{" "}
|
||||
Clicking the "Note Message" button by itself will note to Main by default!
|
||||
|
|
@ -72,7 +72,7 @@ export default ({ onClose, ...modalProps }: ModalProps & { onClose: () => void;
|
|||
<Button
|
||||
look={Button.Looks.FILLED}
|
||||
color={Button.Colors.GREEN}
|
||||
style={{ marginRight: "70px" }}
|
||||
style={{ marginRight: "10px" }}
|
||||
onClick={() => {
|
||||
downloadNotes();
|
||||
}}>Export Notes</Button>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue