Merge pull request #1364 from CyberL1/fix/send-full-application-command-index-commands-object
Add more to `applicationsSendalble`
This commit is contained in:
commit
d1cc40ff4b
@ -20,6 +20,7 @@ import { route } from "@spacebar/api";
|
|||||||
import { Request, Response, Router } from "express";
|
import { Request, Response, Router } from "express";
|
||||||
import { Application, ApplicationCommand, Member, Snowflake } from "@spacebar/util";
|
import { Application, ApplicationCommand, Member, Snowflake } from "@spacebar/util";
|
||||||
import { IsNull } from "typeorm";
|
import { IsNull } from "typeorm";
|
||||||
|
import { ApplicationCommandSchema } from "@spacebar/schemas";
|
||||||
|
|
||||||
const router = Router({ mergeParams: true });
|
const router = Router({ mergeParams: true });
|
||||||
|
|
||||||
@ -52,19 +53,30 @@ router.get("/", route({}), async (req: Request, res: Response) => {
|
|||||||
applicationCommands.push(await ApplicationCommand.find({ where: { application_id: application.id, guild_id: req.params.guild_id } }));
|
applicationCommands.push(await ApplicationCommand.find({ where: { application_id: application.id, guild_id: req.params.guild_id } }));
|
||||||
}
|
}
|
||||||
|
|
||||||
const applicationCommandsSendable = [];
|
const applicationCommandsSendable: ApplicationCommandSchema[] = [];
|
||||||
|
|
||||||
for (const command of applicationCommands.flat()) {
|
for (const command of applicationCommands.flat()) {
|
||||||
applicationCommandsSendable.push({
|
applicationCommandsSendable.push({
|
||||||
application_id: command.application_id,
|
|
||||||
description: command.description,
|
|
||||||
dm_permission: command.dm_permission,
|
|
||||||
global_popularity_rank: command.global_popularity_rank,
|
|
||||||
id: command.id,
|
id: command.id,
|
||||||
integration_types: command.integration_types,
|
|
||||||
name: command.name,
|
|
||||||
type: command.type,
|
type: command.type,
|
||||||
|
application_id: command.application_id,
|
||||||
|
guild_id: command.guild_id,
|
||||||
|
name: command.name,
|
||||||
|
name_localizations: command.name_localizations,
|
||||||
|
// name_localized: // TODO: make this work
|
||||||
|
description: command.description,
|
||||||
|
description_localizations: command.description_localizations,
|
||||||
|
// description_localized: // TODO: make this work
|
||||||
|
options: command.options,
|
||||||
|
default_member_permissions: command.default_member_permissions,
|
||||||
|
dm_permission: command.dm_permission,
|
||||||
|
permissions: command.permissions,
|
||||||
|
nsfw: command.nsfw,
|
||||||
|
integration_types: command.integration_types,
|
||||||
|
global_popularity_rank: command.global_popularity_rank,
|
||||||
|
contexts: command.contexts,
|
||||||
version: command.version,
|
version: command.version,
|
||||||
|
handler: command.handler,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user