From a609dbb0cc9652c0dada96ef8d53cc577dd16608 Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Fri, 24 Feb 2023 20:22:28 -0500 Subject: [PATCH] Add and update references for libUtils - Used for extra code that is used in multiple places --- commands/exit.js | 10 +++++++--- libUtils.js | 7 +++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 libUtils.js diff --git a/commands/exit.js b/commands/exit.js index ef581a0..ba60afd 100644 --- a/commands/exit.js +++ b/commands/exit.js @@ -1,13 +1,17 @@ -var libFlayer = require("../libFlayer.js"); +var libUtils = require("../libUtils.js"); module.exports = { name: 'exit', - description: 'Exit', + description: 'Exit the current application.', + example: "exit", + isPrivileged: true, async execute(message) { + // TODO - Need to add middleware for admins + if (message.member.user.tag !== "Logan#3331") message.reply(`Sorry ${message.member.user.tag}, you are not allowed to use this command.`); message.reply( `Goodbye world - Disconnection imminent.` ); - await libFlayer.sleep(5000); + await libUtils.sleep(5000); await new Promise(resolve => setTimeout(process.exit(), 5000)); } }; \ No newline at end of file diff --git a/libUtils.js b/libUtils.js new file mode 100644 index 0000000..93ca30e --- /dev/null +++ b/libUtils.js @@ -0,0 +1,7 @@ +/** + * sleep - sleep/wait + * @constructor + */ +exports.sleep = (ms) => new Promise((resolve) => { + setTimeout(resolve, ms); + }) \ No newline at end of file