91 lines
1.4 KiB
JavaScript
91 lines
1.4 KiB
JavaScript
const {
|
|
EmbedBuilder
|
|
} = require(
|
|
"discord.js"
|
|
);
|
|
|
|
const {
|
|
temporaryEphemeralReply
|
|
} = require(
|
|
"../../utils/cookieEconomy"
|
|
);
|
|
|
|
const {
|
|
getCrumbSaucerSessionOwner
|
|
} = require(
|
|
"../../utils/crumbSaucer"
|
|
);
|
|
|
|
|
|
function delay(
|
|
ms
|
|
) {
|
|
return new Promise(
|
|
resolve =>
|
|
setTimeout(
|
|
resolve,
|
|
ms
|
|
)
|
|
);
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
name:
|
|
"crumbSaucerClose",
|
|
|
|
|
|
async execute(
|
|
interaction
|
|
) {
|
|
const ownerId =
|
|
getCrumbSaucerSessionOwner(
|
|
interaction
|
|
);
|
|
|
|
|
|
if (
|
|
ownerId !==
|
|
interaction.user.id
|
|
) {
|
|
return temporaryEphemeralReply(
|
|
interaction,
|
|
{
|
|
content:
|
|
"This isn't your Crumb Saucer session."
|
|
}
|
|
);
|
|
}
|
|
|
|
|
|
const embed =
|
|
new EmbedBuilder()
|
|
.setTitle(
|
|
"Closed"
|
|
)
|
|
.setDescription(
|
|
"Closing Crumb Saucer..."
|
|
);
|
|
|
|
|
|
await interaction.update({
|
|
embeds: [
|
|
embed
|
|
],
|
|
|
|
components: []
|
|
});
|
|
|
|
|
|
await delay(
|
|
1500
|
|
);
|
|
|
|
|
|
try {
|
|
await interaction.deleteReply();
|
|
}
|
|
|
|
catch {}
|
|
}
|
|
}; |