mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-31 03:33:36 -05:00
Add Missing Header
This commit is contained in:
parent
6bd3b06de5
commit
1d5d309a97
2 changed files with 11 additions and 20 deletions
|
@ -170,33 +170,18 @@ async function parseFile(fileName: string) {
|
||||||
data.hasCommands = true;
|
data.hasCommands = true;
|
||||||
if (!isArrayLiteralExpression(value)) throw fail("commands is not an array literal");
|
if (!isArrayLiteralExpression(value)) throw fail("commands is not an array literal");
|
||||||
data.commands = value.elements.map((e) => {
|
data.commands = value.elements.map((e) => {
|
||||||
if (!isObjectLiteralExpression(e)) {
|
if (!isObjectLiteralExpression(e)) throw fail("commands array contains non-object literals");
|
||||||
throw fail("commands array contains non-object literals");
|
|
||||||
}
|
|
||||||
|
|
||||||
const nameProperty = e.properties.find((p): p is PropertyAssignment => {
|
const nameProperty = e.properties.find((p): p is PropertyAssignment => {
|
||||||
return isPropertyAssignment(p) && isIdentifier(p.name) && p.name.escapedText === 'name';
|
return isPropertyAssignment(p) && isIdentifier(p.name) && p.name.escapedText === 'name';
|
||||||
});
|
});
|
||||||
|
|
||||||
const descriptionProperty = e.properties.find((p): p is PropertyAssignment => {
|
const descriptionProperty = e.properties.find((p): p is PropertyAssignment => {
|
||||||
return isPropertyAssignment(p) && isIdentifier(p.name) && p.name.escapedText === 'description';
|
return isPropertyAssignment(p) && isIdentifier(p.name) && p.name.escapedText === 'description';
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!nameProperty || !descriptionProperty) throw fail("Command missing required properties");
|
if (!nameProperty || !descriptionProperty) throw fail("Command missing required properties");
|
||||||
|
const name = isStringLiteral(nameProperty.initializer) ? nameProperty.initializer.text : '';
|
||||||
const name = isStringLiteral(nameProperty.initializer)
|
const description = isStringLiteral(descriptionProperty.initializer) ? descriptionProperty.initializer.text : '';
|
||||||
? nameProperty.initializer.text
|
return { name, description };
|
||||||
: '';
|
|
||||||
const description = isStringLiteral(descriptionProperty.initializer)
|
|
||||||
? descriptionProperty.initializer.text
|
|
||||||
: '';
|
|
||||||
|
|
||||||
return {
|
|
||||||
name,
|
|
||||||
description
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "authors":
|
case "authors":
|
||||||
if (!isArrayLiteralExpression(value)) throw fail("authors is not an array literal");
|
if (!isArrayLiteralExpression(value)) throw fail("authors is not an array literal");
|
||||||
|
|
|
@ -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 = {
|
const extensionMap = {
|
||||||
"ogg": [".ogv", ".oga", ".ogx", ".ogm", ".spx", ".opus"],
|
"ogg": [".ogv", ".oga", ".ogx", ".ogm", ".spx", ".opus"],
|
||||||
"jpg": [".jpg", ".jpeg", ".jfif", ".jpe", ".jif", ".jfi", ".pjpeg", ".pjp"],
|
"jpg": [".jpg", ".jpeg", ".jfif", ".jpe", ".jif", ".jfi", ".pjpeg", ".pjp"],
|
||||||
|
|
Loading…
Reference in a new issue