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);
|
const resolved = commands.get(interaction.data.name);
|
||||||
if (!resolved) return interaction.respond("Internal Error: SLASHCOMMAND_NOT_FOUND", { isPrivate: true });
|
if (!resolved) return interaction.respond("Internal Error: SLASHCOMMAND_NOT_FOUND", { isPrivate: true });
|
||||||
|
|
||||||
resolved
|
resolved
|
||||||
.run(interaction)
|
.run(interaction)
|
||||||
.then((response: InteractionResponse) =>
|
.then((response: InteractionResponse) =>
|
||||||
|
|
|
@ -22,9 +22,8 @@ export async function load(client: Bot) {
|
||||||
export function handle(interaction: Interaction) {
|
export function handle(interaction: Interaction) {
|
||||||
const { type } = interaction;
|
const { type } = interaction;
|
||||||
|
|
||||||
if (type == InteractionTypes.ApplicationCommand) {
|
if (type == InteractionTypes.ApplicationCommand) CommandHandler.handle(interaction);
|
||||||
CommandHandler.handle(interaction);
|
else if (type == InteractionTypes.MessageComponent) {
|
||||||
} else if (type == InteractionTypes.MessageComponent) {
|
|
||||||
REST.sendInteractionResponse(interaction.id, interaction.token, {
|
REST.sendInteractionResponse(interaction.id, interaction.token, {
|
||||||
type: InteractionResponseTypes.ChannelMessageWithSource,
|
type: InteractionResponseTypes.ChannelMessageWithSource,
|
||||||
data: {
|
data: {
|
||||||
|
@ -39,7 +38,5 @@ export function handle(interaction: Interaction) {
|
||||||
choices: [{ name: "not_implemented", value: "Not Implemented" }],
|
choices: [{ name: "not_implemented", value: "Not Implemented" }],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else if (type == InteractionTypes.ModalSubmit) {
|
} else if (type == InteractionTypes.ModalSubmit) ModalHandler.handle(interaction);
|
||||||
ModalHandler.handle(interaction);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,10 @@ export function collectModal(modal: Modal): Promise<ModalResponse> {
|
||||||
modal.setId(id);
|
modal.setId(id);
|
||||||
modals.set(id, resolve);
|
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