Merge pull request #1363 from MathMan05/fixes_commandFetch
Fix application-command-index
This commit is contained in:
commit
e22c5725f3
@ -28,7 +28,8 @@ router.get("/", route({}), async (req: Request, res: Response) => {
|
|||||||
const applications: Application[] = [];
|
const applications: Application[] = [];
|
||||||
|
|
||||||
for (const member of members) {
|
for (const member of members) {
|
||||||
applications.push(await Application.findOneOrFail({ where: { id: member.id } }));
|
const app = await Application.findOne({ where: { id: member.id } });
|
||||||
|
if (app) applications.push(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
const applicationsSendable = [];
|
const applicationsSendable = [];
|
||||||
@ -44,17 +45,16 @@ router.get("/", route({}), async (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const globalApplicationCommands: ApplicationCommand[] = [];
|
const applicationCommands: ApplicationCommand[][] = [];
|
||||||
const guildApplicationCommands: ApplicationCommand[] = [];
|
|
||||||
|
|
||||||
for (const application of applications) {
|
for (const application of applications) {
|
||||||
globalApplicationCommands.push(await ApplicationCommand.findOneOrFail({ where: { application_id: application.id, guild_id: IsNull() } }));
|
applicationCommands.push(await ApplicationCommand.find({ where: { application_id: application.id, guild_id: IsNull() } }));
|
||||||
guildApplicationCommands.push(await ApplicationCommand.findOneOrFail({ 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 = [];
|
||||||
|
|
||||||
for (const command of [...globalApplicationCommands, ...guildApplicationCommands]) {
|
for (const command of applicationCommands.flat()) {
|
||||||
applicationCommandsSendable.push({
|
applicationCommandsSendable.push({
|
||||||
application_id: command.application_id,
|
application_id: command.application_id,
|
||||||
description: command.description,
|
description: command.description,
|
||||||
|
|||||||
Reference in New Issue
Block a user