Add Missing Header

This commit is contained in:
thororen1234 2024-10-31 04:37:17 -04:00
parent 6bd3b06de5
commit 1d5d309a97
2 changed files with 11 additions and 20 deletions

View file

@ -170,33 +170,18 @@ async function parseFile(fileName: string) {
data.hasCommands = true;
if (!isArrayLiteralExpression(value)) throw fail("commands is not an array literal");
data.commands = value.elements.map((e) => {
if (!isObjectLiteralExpression(e)) {
throw fail("commands array contains non-object literals");
}
if (!isObjectLiteralExpression(e)) throw fail("commands array contains non-object literals");
const nameProperty = e.properties.find((p): p is PropertyAssignment => {
return isPropertyAssignment(p) && isIdentifier(p.name) && p.name.escapedText === 'name';
});
const descriptionProperty = e.properties.find((p): p is PropertyAssignment => {
return isPropertyAssignment(p) && isIdentifier(p.name) && p.name.escapedText === 'description';
});
if (!nameProperty || !descriptionProperty) throw fail("Command missing required properties");
const name = isStringLiteral(nameProperty.initializer)
? nameProperty.initializer.text
: '';
const description = isStringLiteral(descriptionProperty.initializer)
? descriptionProperty.initializer.text
: '';
return {
name,
description
};
const name = isStringLiteral(nameProperty.initializer) ? nameProperty.initializer.text : '';
const description = isStringLiteral(descriptionProperty.initializer) ? descriptionProperty.initializer.text : '';
return { name, description };
});
break;
case "authors":
if (!isArrayLiteralExpression(value)) throw fail("authors is not an array literal");

View file

@ -1,3 +1,9 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
const extensionMap = {
"ogg": [".ogv", ".oga", ".ogx", ".ogm", ".spx", ".opus"],
"jpg": [".jpg", ".jpeg", ".jfif", ".jpe", ".jif", ".jfi", ".pjpeg", ".pjp"],