fix memory leak o_o
This commit is contained in:
parent
0784d1b8ad
commit
101fd3a879
3 changed files with 8 additions and 7 deletions
|
@ -14,6 +14,7 @@ export function handle(interaction: Interaction) {
|
|||
|
||||
const resolved = commands.get(interaction.data.name);
|
||||
if (!resolved) return interaction.respond("Internal Error: SLASHCOMMAND_NOT_FOUND", { isPrivate: true });
|
||||
|
||||
resolved
|
||||
.run(interaction)
|
||||
.then((response: InteractionResponse) =>
|
||||
|
|
|
@ -22,9 +22,8 @@ export async function load(client: Bot) {
|
|||
export function handle(interaction: Interaction) {
|
||||
const { type } = interaction;
|
||||
|
||||
if (type == InteractionTypes.ApplicationCommand) {
|
||||
CommandHandler.handle(interaction);
|
||||
} else if (type == InteractionTypes.MessageComponent) {
|
||||
if (type == InteractionTypes.ApplicationCommand) CommandHandler.handle(interaction);
|
||||
else if (type == InteractionTypes.MessageComponent) {
|
||||
REST.sendInteractionResponse(interaction.id, interaction.token, {
|
||||
type: InteractionResponseTypes.ChannelMessageWithSource,
|
||||
data: {
|
||||
|
@ -39,7 +38,5 @@ export function handle(interaction: Interaction) {
|
|||
choices: [{ name: "not_implemented", value: "Not Implemented" }],
|
||||
},
|
||||
});
|
||||
} else if (type == InteractionTypes.ModalSubmit) {
|
||||
ModalHandler.handle(interaction);
|
||||
}
|
||||
} else if (type == InteractionTypes.ModalSubmit) ModalHandler.handle(interaction);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,10 @@ export function collectModal(modal: Modal): Promise<ModalResponse> {
|
|||
modal.setId(id);
|
||||
modals.set(id, resolve);
|
||||
|
||||
setTimeout(() => reject(new Error("Modal timeout")), 1000 * 30); //, 1000 * 60 * 30);
|
||||
setTimeout(() => {
|
||||
modals.delete(id);
|
||||
reject(new Error("Modal timeout"));
|
||||
}, 1000 * 60 * 30);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue