feat: error tolerant command registeration

This commit is contained in:
TrèsAbhi committed 2024-03-03 22:21:06 -06:00
1 parent cba93b3d55
commit 11a0c246dc
1 file changed
+8 -11
+8 -11
View File
@@ -112,19 +112,16 @@ export const COMMANDS_RAW: CommandRegistry[] = [
todayCommand,
];
export const commands = Promise.all(COMMANDS_RAW).then((rawCommands) =>
rawCommands.reduce<Record<string, CommandRegistryPromisable>>(
(accumulator, registry) => {
if (isDev()) registry.command.setDefaultMemberPermissions(0);
return {
...accumulator,
[registry.command.name]: registry,
};
export const commands = Promise.allSettled(COMMANDS_RAW).then((rawCommands) => {
return rawCommands.reduce<Record<string, CommandRegistryPromisable>>(
(commands, registry) => {
if (registry.status === 'rejected') return commands;
if (isDev()) registry.value.command.setDefaultMemberPermissions(0);
return { ...commands, [registry.value.command.name]: registry.value };
},
{},
),
);
);
});
export const guildCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] =
[];