Skip to content

Commit

Permalink
ughhh
Browse files Browse the repository at this point in the history
  • Loading branch information
wont-stream committed Dec 10, 2024
1 parent b137e11 commit f263206
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 107 deletions.
7 changes: 0 additions & 7 deletions _api/Badges/index.ts

This file was deleted.

7 changes: 2 additions & 5 deletions _api/MessageEvents/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
const addPreSendListener = (a) => {}
const removePreSendListener = (a) => {}
type SendListener = object

export { addPreSendListener, removePreSendListener, type SendListener }
export type * from '@vencord/types/api/MessageEvents'
export { addPreSendListener, removePreSendListener } from '@vencord/types/api/MessageEvents'
4 changes: 1 addition & 3 deletions _api/Settings/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
const definePluginSettings = () => {}

export {definePluginSettings}
export type * from '@vencord/types/api/Settings'
7 changes: 1 addition & 6 deletions _utils/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@

// biome-ignore lint/suspicious/noExplicitAny: <explanation>
const definePlugin = (config: any) => {
return config;
}

const OptionType = {
BOOLEAN: 1
}

export default definePlugin;

export { OptionType}
export type * from '@vencord/types/utils/types'
9 changes: 0 additions & 9 deletions _webpack/common/index.ts

This file was deleted.

6 changes: 0 additions & 6 deletions _webpack/findAll.ts

This file was deleted.

5 changes: 0 additions & 5 deletions _webpack/package.json

This file was deleted.

Binary file modified bun.lockb
Binary file not shown.
5 changes: 3 additions & 2 deletions globalBadgesReloaded/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { addBadge, BadgePosition, BadgeUserArgs, ProfileBadge, removeBadge } from "@api/Badges";
import definePlugin, { OptionType } from "@utils/types";
import definePlugin from "@utils/types";
import { React, Tooltip } from "@webpack/common";

type CustomBadge = string | {
Expand Down Expand Up @@ -27,7 +27,8 @@ async function fetchBadges(id: string): Promise<BadgeCache["badges"] | undefined
const body = await resp.json() as BadgeCache["badges"];
cache.set(id, { badges: body, expires: Date.now() + EXPIRES });
return body;
} else if (cachedValue) {
}
if (cachedValue) {
return cachedValue.badges;
}
};
Expand Down
57 changes: 4 additions & 53 deletions grammarNazi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
type SendListener,
} from "@api/MessageEvents";
import { definePluginSettings } from "@api/Settings";
import definePlugin, { OptionType } from "@utils/types";
import definePlugin from "@utils/types";
import OptionType from "@utils/types";

const settings = definePluginSettings({
autoCapitalization: {
Expand All @@ -27,56 +28,6 @@ const settings = definePluginSettings({
},
});

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, "\\$&"))
.join("|")})((?=[^A-Z0-9]+)|$)`,
"gi",
);
if (re !== null) {
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,
)
)
msg.content += ".";
}
}

// Ensure sentences are capitalized after punctuation
if (settings.store.autoCapitalization) {
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);
}
}
}
};
return presendObject;
};

export default definePlugin({
name: "Grammar Nazi",
description: "Automatic punctuation, capitalization, and word replacement.",
Expand All @@ -89,10 +40,10 @@ export default definePlugin({
);
dictionary = await dictionary.json();

addPreSendListener(getPresend(dictionary));
addPreSendListener(this.getPresend(dictionary));
},
stop() {
removePreSendListener(getPresend({}));
removePreSendListener(this.getPresend({}));
},

getPresend(dictionary: Object) {
Expand Down
6 changes: 4 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ const files = glob.scanSync(".");
let readme = "# M€NT4LLY G€RM4N Vencord Plugins <a href=\"https://docs.vencord.dev/installing/custom-plugins\"><kbd>Installation</kbd></a>\n\n";

for (const file of files) {
console.log(file);
const { default: { name, description }} = await import(`./${file}`);

readme += `## ${name} <a href="https://github.com/MENTALLY-GERM4N/vencord-plugins/raw/refs/heads/main/${file.replaceAll("\\", "/")}"><kbd>Download</kbd></a>\n`
readme += `${description}\n\n`;
}

await write("README.md", readme);

/*
await $`git add .`.quiet();
await $`git commit -m "Update"`.quiet();
await $`git push`.quiet();
await $`git push`.quiet();
*/
4 changes: 2 additions & 2 deletions openOptimizer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export default definePlugin({
authors: [{ name: "S€th", id: 1273447359417942128n }],
methods: ['removeChild', 'appendChild'],
start() {
for (const method of this.methods) {
for (const method of this.methods as (keyof Element)[]) {
this[`_${method}`] = Element.prototype[method];
Element.prototype[method] = this.optimize(Element.prototype[method]);
}
},
stop() {
for (const method of this.methods) {
for (const method of this.methods as (keyof Element)[]) {
Element.prototype[method] = this[`_${method}`];
}
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@utils": "file:_utils",
"@webpack": "file:_webpack",
"@vencord/types": "^1.8.4",
"@api": "file:_api",
"tsx-dom": "^3.0.1"
}
Expand Down
7 changes: 1 addition & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false,

"jsxImportSource": "tsx-dom",
"paths": {
"tsx-dom/jsx-dev-runtime": ["./node_modules/tsx-dom/src/jsx-runtime.ts"]
}
"noPropertyAccessFromIndexSignature": false
}
}

0 comments on commit f263206

Please sign in to comment.