mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-20 15:18:50 -05:00
Haha Funny Moment
This commit is contained in:
parent
1a37064f2e
commit
c21e29f3d7
4 changed files with 40 additions and 6 deletions
|
@ -44,6 +44,7 @@ interface PluginData {
|
|||
}
|
||||
|
||||
const devs = {} as Record<string, Dev>;
|
||||
const equicordDevs = {} as Record<string, Dev>;
|
||||
|
||||
function getName(node: NamedDeclaration) {
|
||||
return node.name && isIdentifier(node.name) ? node.name.text : undefined;
|
||||
|
@ -90,6 +91,37 @@ function parseDevs() {
|
|||
throw new Error("Could not find Devs constant");
|
||||
}
|
||||
|
||||
function parseEquicordDevs() {
|
||||
const file = createSourceFile("constants.ts", readFileSync("src/utils/constants.ts", "utf8"), ScriptTarget.Latest);
|
||||
|
||||
for (const child of file.getChildAt(0).getChildren()) {
|
||||
if (!isVariableStatement(child)) continue;
|
||||
|
||||
const devsDeclaration = child.declarationList.declarations.find(d => hasName(d, "EquicordDevs"));
|
||||
if (!devsDeclaration?.initializer || !isCallExpression(devsDeclaration.initializer)) continue;
|
||||
|
||||
const value = devsDeclaration.initializer.arguments[0];
|
||||
|
||||
if (!isSatisfiesExpression(value) || !isObjectLiteralExpression(value.expression)) throw new Error("Failed to parse EquicordDevs: not an object literal");
|
||||
|
||||
for (const prop of value.expression.properties) {
|
||||
const name = (prop.name as Identifier).text;
|
||||
const value = isPropertyAssignment(prop) ? prop.initializer : prop;
|
||||
|
||||
if (!isObjectLiteralExpression(value)) throw new Error(`Failed to parse EquicordDevs: ${name} is not an object literal`);
|
||||
|
||||
equicordDevs[name] = {
|
||||
name: (getObjectProp(value, "name") as StringLiteral).text,
|
||||
id: (getObjectProp(value, "id") as BigIntLiteral).text.slice(0, -1)
|
||||
};
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error("Could not find EquicordDevs constant");
|
||||
}
|
||||
|
||||
async function parseFile(fileName: string) {
|
||||
const file = createSourceFile(fileName, await readFile(fileName, "utf8"), ScriptTarget.Latest);
|
||||
|
||||
|
@ -134,7 +166,7 @@ async function parseFile(fileName: string) {
|
|||
if (!isArrayLiteralExpression(value)) throw fail("authors is not an array literal");
|
||||
data.authors = value.elements.map(e => {
|
||||
if (!isPropertyAccessExpression(e)) throw fail("authors array contains non-property access expressions");
|
||||
const d = devs[getName(e)!];
|
||||
const d = devs[getName(e)!] || equicordDevs[getName(e)!];
|
||||
if (!d) throw fail(`couldn't look up author ${getName(e)}`);
|
||||
return d;
|
||||
});
|
||||
|
@ -205,6 +237,7 @@ function isPluginFile({ name }: { name: string; }) {
|
|||
|
||||
(async () => {
|
||||
parseDevs();
|
||||
parseEquicordDevs();
|
||||
|
||||
const plugins = [] as PluginData[];
|
||||
const readmes = {} as Record<string, string>;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
import { DataStore } from "@api/index";
|
||||
import { Devs, SUPPORT_CHANNEL_ID, SUPPORT_CHANNEL_IDS, VC_SUPPORT_CHANNEL_ID } from "@utils/constants";
|
||||
import { Devs, EquicordDevs, SUPPORT_CHANNEL_ID, SUPPORT_CHANNEL_IDS, VC_SUPPORT_CHANNEL_ID } from "@utils/constants";
|
||||
import { isEquicordPluginDev, isPluginDev } from "@utils/misc";
|
||||
import { makeCodeblock } from "@utils/text";
|
||||
import definePlugin from "@utils/types";
|
||||
|
@ -41,7 +41,7 @@ export default definePlugin({
|
|||
name: "SupportHelper",
|
||||
required: true,
|
||||
description: "Helps us provide support to you",
|
||||
authors: [Devs.Ven],
|
||||
authors: [Devs.Ven, EquicordDevs.thororen],
|
||||
dependencies: ["CommandsAPI"],
|
||||
|
||||
commands: [{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
import "./index.css";
|
||||
|
||||
import { openNotificationLogModal } from "@api/Notifications/notificationLog";
|
||||
import { Settings, useSettings } from "@api/Settings";
|
||||
import { migratePluginSettings, Settings, useSettings } from "@api/Settings";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
|
@ -130,6 +130,7 @@ function ToolboxFragmentWrapper({ children }: { children: ReactNode[]; }) {
|
|||
return <>{children}</>;
|
||||
}
|
||||
|
||||
migratePluginSettings("EquicordToolbox", "VencordToolbox");
|
||||
export default definePlugin({
|
||||
name: "EquicordToolbox",
|
||||
description: "Adds a button next to the inbox button in the channel header that houses Equicord quick actions",
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
import "./style.css";
|
||||
|
||||
import { addServerListElement, removeServerListElement, ServerListRenderPosition } from "@api/ServerList";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { Button, FluxDispatcher, GuildChannelStore, GuildStore, React, ReadStateStore } from "@webpack/common";
|
||||
|
||||
|
@ -61,7 +61,7 @@ const ReadAllButton = () => (
|
|||
export default definePlugin({
|
||||
name: "ReadAllNotificationsButton",
|
||||
description: "Read all server notifications with a single button click!",
|
||||
authors: [Devs.kemo],
|
||||
authors: [Devs.kemo, EquicordDevs.KrystalSkull],
|
||||
dependencies: ["ServerListAPI"],
|
||||
|
||||
renderReadAllButton: () => <ReadAllButton />,
|
||||
|
|
Loading…
Add table
Reference in a new issue