mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Reformat all files with Prettier
This commit is contained in:
parent
0cde0d46d2
commit
ac79eb09f5
206 changed files with 727 additions and 888 deletions
|
@ -33,21 +33,21 @@ function simpleDiscordAPIRequest(bearerToken, path): Promise<any> {
|
|||
Authorization: `Bearer ${bearerToken}`,
|
||||
},
|
||||
},
|
||||
res => {
|
||||
(res) => {
|
||||
if (res.statusCode !== 200) {
|
||||
reject(new Error(`Discord API error ${res.statusCode}`));
|
||||
return;
|
||||
}
|
||||
|
||||
let rawData = "";
|
||||
res.on("data", data => (rawData += data));
|
||||
res.on("data", (data) => (rawData += data));
|
||||
res.on("end", () => {
|
||||
resolve(JSON.parse(rawData));
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
request.on("error", err => reject(err));
|
||||
request.on("error", (err) => reject(err));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -22,21 +22,21 @@ function formatConfigSchema(schema) {
|
|||
} else if (schema.name.startsWith("Optional<")) {
|
||||
return `Optional<${formatConfigSchema(schema.types[0])}>`;
|
||||
} else {
|
||||
return schema.types.map(t => formatConfigSchema(t)).join(" | ");
|
||||
return schema.types.map((t) => formatConfigSchema(t)).join(" | ");
|
||||
}
|
||||
} else if (schema._tag === "IntersectionType") {
|
||||
return schema.types.map(t => formatConfigSchema(t)).join(" & ");
|
||||
return schema.types.map((t) => formatConfigSchema(t)).join(" & ");
|
||||
} else {
|
||||
return schema.name;
|
||||
}
|
||||
}
|
||||
|
||||
export function initDocs(app: express.Express) {
|
||||
const docsPlugins = guildPlugins.filter(plugin => plugin.showInDocs);
|
||||
const docsPlugins = guildPlugins.filter((plugin) => plugin.showInDocs);
|
||||
|
||||
app.get("/docs/plugins", (req: express.Request, res: express.Response) => {
|
||||
res.json(
|
||||
docsPlugins.map(plugin => {
|
||||
docsPlugins.map((plugin) => {
|
||||
const thinInfo = plugin.info ? { prettyName: plugin.info.prettyName, legacy: plugin.info.legacy ?? false } : {};
|
||||
return {
|
||||
name: plugin.name,
|
||||
|
@ -56,7 +56,7 @@ export function initDocs(app: express.Express) {
|
|||
const name = plugin.name;
|
||||
const info = plugin.info || {};
|
||||
|
||||
const commands = (plugin.commands || []).map(cmd => ({
|
||||
const commands = (plugin.commands || []).map((cmd) => ({
|
||||
trigger: cmd.trigger,
|
||||
permission: cmd.permission,
|
||||
signature: cmd.signature,
|
||||
|
|
|
@ -131,7 +131,7 @@ export function initGuildsAPI(app: express.Express) {
|
|||
}
|
||||
const validPermissions = new Set(Object.values(ApiPermissions));
|
||||
validPermissions.delete(ApiPermissions.Owner);
|
||||
if (!Array.isArray(permissions) || permissions.some(p => !validPermissions.has(p))) {
|
||||
if (!Array.isArray(permissions) || permissions.some((p) => !validPermissions.has(p))) {
|
||||
return clientError(res, "Invalid permissions");
|
||||
}
|
||||
if (expiresAt != null && !moment.utc(expiresAt).isValid()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue