mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 18:59:19 +00:00
Added Unload Global
This commit is contained in:
@@ -25,7 +25,7 @@ const EMBEDS = {
|
||||
fields: [
|
||||
{
|
||||
name: 'Available arguments',
|
||||
value: '``reloadAll`` ``unloadAll`` ``reloadglobal``'
|
||||
value: '``reloadAll`` ``unloadAll`` ``reloadGlobal`` ``unloadGlobal``'
|
||||
}
|
||||
],
|
||||
user: data.getUser()
|
||||
@@ -126,6 +126,36 @@ export default class InteractionManager extends DiscordModule {
|
||||
);
|
||||
}
|
||||
},
|
||||
unloadGlobal: async (data: HybridInteractionMessage) => {
|
||||
let placeholder: HybridInteractionMessage | undefined;
|
||||
|
||||
let _placeholder = await sendHybridInteractionMessageResponse(data, {
|
||||
embeds: [EMBEDS.PROCESSING(data)]
|
||||
});
|
||||
if (_placeholder) placeholder = new HybridInteractionMessage(_placeholder);
|
||||
|
||||
try {
|
||||
await unregisterAllGlobalCommands();
|
||||
|
||||
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
||||
return placeholder.getMessage().edit({ embeds: [EMBEDS.UNLOADALL_SUCCESS(data)] });
|
||||
else if (data.isApplicationCommand())
|
||||
return await sendHybridInteractionMessageResponse(
|
||||
data,
|
||||
{ embeds: [EMBEDS.UNLOADALL_SUCCESS(data)] },
|
||||
true
|
||||
);
|
||||
} catch (err) {
|
||||
if (data && data.isMessage() && placeholder && placeholder.isMessage())
|
||||
return placeholder.getMessage().edit({ embeds: [EMBEDS.UNLOADALL_ERROR(data, err)] });
|
||||
else if (data.isApplicationCommand())
|
||||
return await sendHybridInteractionMessageResponse(
|
||||
data,
|
||||
{ embeds: [EMBEDS.UNLOADALL_ERROR(data, err)] },
|
||||
true
|
||||
);
|
||||
}
|
||||
},
|
||||
reloadGlobal: async (data: HybridInteractionMessage) => {
|
||||
let placeholder: HybridInteractionMessage | undefined;
|
||||
|
||||
@@ -214,6 +244,8 @@ export default class InteractionManager extends DiscordModule {
|
||||
return await funct.reloadGlobal(data);
|
||||
case 'unloadall':
|
||||
return await funct.unloadAll(data);
|
||||
case 'unloadglobal':
|
||||
return await funct.unloadGlobal(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user