diff --git a/src/equicordplugins/ViewRawVariant/index.tsx b/src/equicordplugins/ViewRawVariant/index.tsx
new file mode 100644
index 00000000..fc29d2d4
--- /dev/null
+++ b/src/equicordplugins/ViewRawVariant/index.tsx
@@ -0,0 +1,150 @@
+/*
+ * Vencord, a Discord client mod
+ * Copyright (c) 2024 Vendicated and contributors
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+import { NavContextMenuPatchCallback } from "@api/ContextMenu";
+import { migratePluginSettings } from "@api/Settings";
+import { CodeBlock } from "@components/CodeBlock";
+import ErrorBoundary from "@components/ErrorBoundary";
+import { Devs } from "@utils/constants";
+import { getIntlMessage } from "@utils/discord";
+import { Margins } from "@utils/margins";
+import {
+ closeModal,
+ ModalCloseButton,
+ ModalContent,
+ ModalHeader,
+ ModalRoot,
+ ModalSize,
+ openModal,
+} from "@utils/modal";
+import definePlugin from "@utils/types";
+import { Forms, Menu, Text } from "@webpack/common";
+import { Message } from "discord-types/general";
+
+migratePluginSettings("ViewRawVariant", "ViewRaw2");
+
+type CustomMessage = Message & {
+ editHistory?: any;
+ deleted?: any;
+ firstEditTimestamp?: any;
+};
+
+const CopyIcon = () => {
+ return (
+
+ );
+};
+
+function cleanMessage(msg: CustomMessage) {
+ const author = { ...msg.author } as any;
+ delete author.email;
+ delete author.phone;
+ delete author.mfaEnabled;
+ delete author.personalConnectionId;
+ delete msg.editHistory;
+ delete msg.deleted;
+ delete msg.firstEditTimestamp;
+ return { ...msg, author };
+}
+
+function openViewRawModal(obj: any, type: string, isMessage?: boolean) {
+ const key = openModal((props) => (
+
+
+
+
+ View Raw {type}
+
+ closeModal(key)} />
+
+
+
+ {isMessage && (
+ <>
+
+ Content
+
+
+
+ >
+ )}
+
+ {type} Data
+
+
+
+
+
+ ));
+}
+
+function makeContextCallback(
+ name: string,
+ action: (any) => void,
+): NavContextMenuPatchCallback {
+ return (children, props) => {
+ if (props.label === getIntlMessage("CHANNEL_ACTIONS_MENU_LABEL"))
+ return; // random shit like notification settings
+
+ const value = props[name];
+ if (!value) return;
+
+ const lastChild = children.at(-1);
+ if (lastChild?.key === "developer-actions") {
+ const p = lastChild.props;
+ if (!Array.isArray(p.children)) p.children = [p.children];
+
+ children = p.children;
+ }
+
+ children.push(
+
action(value)}
+ icon={CopyIcon}
+ />,
+ );
+ };
+}
+
+export default definePlugin({
+ name: "ViewRawVariant",
+ description:
+ "Copy/View raw content of any message, channel, or guild, but show in the right click menu.",
+ authors: [Devs.KingFish, Devs.Ven, Devs.rad, Devs.ImLvna, Devs.Kyuuhachi],
+ contextMenus: {
+ "guild-context": makeContextCallback("guild", (val) =>
+ openViewRawModal(val, "Guild"),
+ ),
+ "channel-context": makeContextCallback("channel", (val) =>
+ openViewRawModal(val, "Channel"),
+ ),
+ "user-context": makeContextCallback("user", (val) =>
+ openViewRawModal(val, "User"),
+ ),
+ message: makeContextCallback("message", (val) =>
+ openViewRawModal(cleanMessage(val), "Message", true),
+ ),
+ },
+});
diff --git a/src/equicordplugins/grammarFix/index.ts b/src/equicordplugins/grammarFix/index.ts
index b5c38829..0ec7d6f7 100644
--- a/src/equicordplugins/grammarFix/index.ts
+++ b/src/equicordplugins/grammarFix/index.ts
@@ -13,57 +13,64 @@ import { definePluginSettings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
-const settings = definePluginSettings(
- {
- autoCapitalization: {
- type: OptionType.BOOLEAN,
- description: "Auto Capitalization to the first letter"
- },
- autoPunctuation: {
- type: OptionType.BOOLEAN,
- description: "Auto Punctuation at the end of a sentence"
- },
- autoWordReplacement: {
- type: OptionType.BOOLEAN,
- description: "Auto Capitalizes the first letter"
- }
- }
-);
+const settings = definePluginSettings({
+ autoCapitalization: {
+ type: OptionType.BOOLEAN,
+ description: "Auto Capitalization to the first letter",
+ },
+ autoPunctuation: {
+ type: OptionType.BOOLEAN,
+ description: "Auto Punctuation at the end of a sentence",
+ },
+ autoWordReplacement: {
+ type: OptionType.BOOLEAN,
+ description: "Auto Capitalizes the first letter",
+ },
+});
-const getPresend = dictionary => {
+const getPresend = (dictionary) => {
const presendObject: SendListener = (_, msg) => {
msg.content = msg.content.trim();
if (!msg.content.includes("```") && /\w/.test(msg.content.charAt(0))) {
if (settings.store.autoWordReplacement) {
const re = new RegExp(
`(^|(?<=[^A-Z0-9]+))(${Object.keys(dictionary)
- .map(k => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
+ .map((k) => k.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
.join("|")})((?=[^A-Z0-9]+)|$)`,
- "gi"
+ "gi",
);
if (re !== null) {
- msg.content = msg.content.replace(re, match => {
+ msg.content = msg.content.replace(re, (match) => {
return dictionary[match.toLowerCase()] || match;
});
}
}
if (settings.store.autoPunctuation) {
- if (/[A-Z0-9]/i.test(msg.content.charAt(msg.content.length - 1))) {
- if (!msg.content.startsWith("http", msg.content.lastIndexOf(" ") + 1))
+ if (
+ /[A-Z0-9]/i.test(msg.content.charAt(msg.content.length - 1))
+ ) {
+ if (
+ !msg.content.startsWith(
+ "http",
+ msg.content.lastIndexOf(" ") + 1,
+ )
+ )
msg.content += ".";
}
}
// Ensure sentences are capitalized after punctuation
if (settings.store.autoCapitalization) {
- msg.content = msg.content.replace(/([.!?])\s*(\w)/g, match =>
- match.toUpperCase()
+ msg.content = msg.content.replace(/([.!?])\s*(\w)/g, (match) =>
+ match.toUpperCase(),
);
// Ensure the first character of the entire message is capitalized
if (!msg.content.startsWith("http")) {
- msg.content = msg.content.charAt(0).toUpperCase() + msg.content.slice(1);
+ msg.content =
+ msg.content.charAt(0).toUpperCase() +
+ msg.content.slice(1);
}
}
}
@@ -79,7 +86,7 @@ export default definePlugin({
settings,
async start() {
let dictionary = await fetch(
- "https://raw.githubusercontent.com/wont-stream/dictionary/3d52fecd9aca5dfee0fcde0df2c2af357f977df7/index.min.json"
+ "https://raw.githubusercontent.com/wont-stream/dictionary/3d52fecd9aca5dfee0fcde0df2c2af357f977df7/index.min.json",
);
dictionary = await dictionary.json();
diff --git a/src/equicordplugins/grammar/index.ts b/src/equicordplugins/polishWording/index.ts
similarity index 53%
rename from src/equicordplugins/grammar/index.ts
rename to src/equicordplugins/polishWording/index.ts
index c84a1fb2..98107ad4 100644
--- a/src/equicordplugins/grammar/index.ts
+++ b/src/equicordplugins/polishWording/index.ts
@@ -4,8 +4,16 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { addPreSendListener, removePreSendListener, SendListener, } from "@api/MessageEvents";
-import { definePluginSettings, Settings } from "@api/Settings";
+import {
+ addPreSendListener,
+ removePreSendListener,
+ SendListener,
+} from "@api/MessageEvents";
+import {
+ definePluginSettings,
+ migratePluginSettings,
+ Settings,
+} from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
@@ -13,18 +21,20 @@ const presendObject: SendListener = (channelId, msg) => {
msg.content = textProcessing(msg.content);
};
-const settings = definePluginSettings(
- {
- blockedWords: {
- type: OptionType.STRING,
- description: "Words that will not be capitalised",
- default: ""
- }
- });
+migratePluginSettings("PolishWording", "Grammar");
+
+const settings = definePluginSettings({
+ blockedWords: {
+ type: OptionType.STRING,
+ description: "Words that will not be capitalised",
+ default: "",
+ },
+});
export default definePlugin({
- name: "Grammar",
- description: "Tweaks your messages to make them look nicer and have better grammar",
+ name: "PolishWording",
+ description:
+ "Tweaks your messages to make them look nicer and have better grammar",
authors: [Devs.Samwich],
dependencies: ["MessageEventsAPI"],
start() {
@@ -33,7 +43,7 @@ export default definePlugin({
stop() {
removePreSendListener(presendObject);
},
- settings
+ settings,
});
function textProcessing(input: string) {
@@ -44,14 +54,18 @@ function textProcessing(input: string) {
}
function apostrophe(textInput: string): string {
- const corrected = "wasn't, can't, don't, won't, isn't, aren't, haven't, hasn't, hadn't, doesn't, didn't, shouldn't, wouldn't, couldn't, i'm, you're, he's, she's, it's, they're, that's, who's, what's, there's, here's, how's, where's, when's, why's, let's, you'll, I'll, they'll, it'll, I've, you've, we've, they've, you'd, he'd, she'd, it'd, we'd, they'd, y'all".toLowerCase();
+ const corrected =
+ "wasn't, can't, don't, won't, isn't, aren't, haven't, hasn't, hadn't, doesn't, didn't, shouldn't, wouldn't, couldn't, i'm, you're, he's, she's, it's, they're, that's, who's, what's, there's, here's, how's, where's, when's, why's, let's, you'll, I'll, they'll, it'll, I've, you've, we've, they've, you'd, he'd, she'd, it'd, we'd, they'd, y'all".toLowerCase();
const words: string[] = corrected.split(", ");
const wordsInputted = textInput.split(" ");
- wordsInputted.forEach(element => {
- words.forEach(wordelement => {
+ wordsInputted.forEach((element) => {
+ words.forEach((wordelement) => {
if (removeApostrophes(wordelement) === element.toLowerCase()) {
- wordsInputted[wordsInputted.indexOf(element)] = restoreCap(wordelement, getCapData(element));
+ wordsInputted[wordsInputted.indexOf(element)] = restoreCap(
+ wordelement,
+ getCapData(element),
+ );
}
});
});
@@ -64,7 +78,6 @@ function getCapData(str: string) {
booleanArray.push(char === char.toUpperCase());
}
return booleanArray;
-
}
function removeApostrophes(str: string): string {
@@ -90,20 +103,22 @@ function restoreCap(str: string, data: boolean[]): string {
}
function cap(textInput: string): string {
-
const sentences = textInput.split(/(?<=\w\.)\s/);
- const blockedWordsArray: string[] = Settings.plugins.Grammar.blockedWords.split(", ");
+ const blockedWordsArray: string[] =
+ Settings.plugins.PolishWording.blockedWords.split(", ");
- return sentences.map(element => {
-
- if (!blockedWordsArray.some(word => element.toLowerCase().startsWith(word.toLowerCase()))) {
- return element.charAt(0).toUpperCase() + element.slice(1);
- }
- else {
- return element;
- }
-
- }).join(" ");
+ return sentences
+ .map((element) => {
+ if (
+ !blockedWordsArray.some((word) =>
+ element.toLowerCase().startsWith(word.toLowerCase()),
+ )
+ ) {
+ return element.charAt(0).toUpperCase() + element.slice(1);
+ } else {
+ return element;
+ }
+ })
+ .join(" ");
}
-
diff --git a/src/equicordplugins/viewRaw2/index.tsx b/src/equicordplugins/viewRaw2/index.tsx
deleted file mode 100644
index 4518d3b2..00000000
--- a/src/equicordplugins/viewRaw2/index.tsx
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Vencord, a Discord client mod
- * Copyright (c) 2024 Vendicated and contributors
- * SPDX-License-Identifier: GPL-3.0-or-later
- */
-
-import { NavContextMenuPatchCallback } from "@api/ContextMenu";
-import { CodeBlock } from "@components/CodeBlock";
-import ErrorBoundary from "@components/ErrorBoundary";
-import { Devs } from "@utils/constants";
-import { getIntlMessage } from "@utils/discord";
-import { Margins } from "@utils/margins";
-import { closeModal, ModalCloseButton, ModalContent, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import definePlugin from "@utils/types";
-import { Forms, Menu, Text } from "@webpack/common";
-import { Message } from "discord-types/general";
-
-type CustomMessage = Message & { editHistory?: any; deleted?: any; firstEditTimestamp?: any; };
-
-const CopyIcon = () => {
- return ;
-};
-
-function cleanMessage(msg: CustomMessage) {
- const author = { ...msg.author } as any;
- delete author.email;
- delete author.phone;
- delete author.mfaEnabled;
- delete author.personalConnectionId;
- delete msg.editHistory;
- delete msg.deleted;
- delete msg.firstEditTimestamp;
- return { ...msg, author };
-}
-
-function openViewRawModal(obj: any, type: string, isMessage?: boolean) {
- const key = openModal(props => (
-
-
-
- View Raw {type}
- closeModal(key)} />
-
-
-
- {isMessage && (
- <>
- Content
-
-
- >
- )}
-
- {type} Data
-
-
-
-
-
- ));
-}
-
-function makeContextCallback(name: string, action: (any) => void): NavContextMenuPatchCallback {
- return (children, props) => {
- if (props.label === getIntlMessage("CHANNEL_ACTIONS_MENU_LABEL")) return; // random shit like notification settings
-
- const value = props[name];
- if (!value) return;
-
- const lastChild = children.at(-1);
- if (lastChild?.key === "developer-actions") {
- const p = lastChild.props;
- if (!Array.isArray(p.children))
- p.children = [p.children];
-
- children = p.children;
- }
-
- children.push(
- action(value)}
- icon={CopyIcon}
- />
- );
- };
-}
-
-export default definePlugin({
- name: "ViewRaw2",
- description: "Copy and view the raw content/data of any message, channel or guild",
- authors: [Devs.KingFish, Devs.Ven, Devs.rad, Devs.ImLvna, Devs.Kyuuhachi],
- contextMenus: {
- "guild-context": makeContextCallback("guild", val => openViewRawModal(val, "Guild")),
- "channel-context": makeContextCallback("channel", val => openViewRawModal(val, "Channel")),
- "user-context": makeContextCallback("user", val => openViewRawModal(val, "User")),
- "message": makeContextCallback("message", val => openViewRawModal(cleanMessage(val), "Message", true)),
- }
-});