mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: error tolerant command registeration
This commit is contained in:
1 parent
cba93b3d55
commit
11a0c246dc
1 file changed
+8
-11
@@ -112,19 +112,16 @@ export const COMMANDS_RAW: CommandRegistry[] = [
|
|||||||
todayCommand,
|
todayCommand,
|
||||||
];
|
];
|
||||||
|
|
||||||
export const commands = Promise.all(COMMANDS_RAW).then((rawCommands) =>
|
export const commands = Promise.allSettled(COMMANDS_RAW).then((rawCommands) => {
|
||||||
rawCommands.reduce<Record<string, CommandRegistryPromisable>>(
|
return rawCommands.reduce<Record<string, CommandRegistryPromisable>>(
|
||||||
(accumulator, registry) => {
|
(commands, registry) => {
|
||||||
if (isDev()) registry.command.setDefaultMemberPermissions(0);
|
if (registry.status === 'rejected') return commands;
|
||||||
|
if (isDev()) registry.value.command.setDefaultMemberPermissions(0);
|
||||||
return {
|
return { ...commands, [registry.value.command.name]: registry.value };
|
||||||
...accumulator,
|
|
||||||
[registry.command.name]: registry,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
{},
|
{},
|
||||||
),
|
);
|
||||||
);
|
});
|
||||||
|
|
||||||
export const guildCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] =
|
export const guildCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] =
|
||||||
[];
|
[];
|
||||||
|
|||||||
Reference in new issue
Block a user