diff --git a/package-lock.json b/package-lock.json index 3421a13..6221e53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ce-discord-bot", - "version": "1.0.1", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ce-discord-bot", - "version": "1.0.1", + "version": "1.1.0", "license": "ISC", "dependencies": { "cross-fetch": "^4.0.0", @@ -14,8 +14,7 @@ "dotenv": "^16.3.1", "emoji-regex": "^10.3.0", "js-yaml": "^4.1.0", - "mongodb": "^6.3.0", - "ora": "^3.2.0" + "mongodb": "^6.3.0" }, "devDependencies": { "concurrently": "^8.2.2", @@ -310,6 +309,7 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, "dependencies": { "color-convert": "^1.9.0" }, @@ -412,6 +412,7 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -457,28 +458,6 @@ "node": ">=10" } }, - "node_modules/cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==", - "dependencies": { - "restore-cursor": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/cli-spinners": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.1.tgz", - "integrity": "sha512-jHgecW0pxkonBJdrKsqxgRX9AcG+u/5k0Q7WPDfi8AogLAdwxEkyYYNWwZ5GvVFoFx2uiY1eNcSK00fh+1+FyQ==", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -584,18 +563,11 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", - "engines": { - "node": ">=0.8" - } - }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, "dependencies": { "color-name": "1.1.3" } @@ -603,7 +575,8 @@ "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true }, "node_modules/commander": { "version": "10.0.1", @@ -790,17 +763,6 @@ "url": "https://opencollective.com/date-fns" } }, - "node_modules/defaults": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", - "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", - "dependencies": { - "clone": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -886,6 +848,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, "engines": { "node": ">=0.8.0" } @@ -1085,6 +1048,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, "engines": { "node": ">=4" } @@ -1246,17 +1210,6 @@ "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", "integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw==" }, - "node_modules/log-symbols": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", - "dependencies": { - "chalk": "^2.0.1" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/lru-cache": { "version": "10.0.2", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.2.tgz", @@ -1301,14 +1254,6 @@ "node": ">=8.6" } }, - "node_modules/mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "engines": { - "node": ">=4" - } - }, "node_modules/minimatch": { "version": "9.0.3", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", @@ -1496,52 +1441,6 @@ "node": ">=0.10.0" } }, - "node_modules/onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ==", - "dependencies": { - "mimic-fn": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/ora": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ora/-/ora-3.2.0.tgz", - "integrity": "sha512-XHMZA5WieCbtg+tu0uPF8CjvwQdNzKCX6BVh3N6GFsEXH40mTk5dsw/ya1lBTUGJslcEFJFQ8cBhOgkkZXQtMA==", - "dependencies": { - "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", - "cli-spinners": "^2.0.0", - "log-symbols": "^2.2.0", - "strip-ansi": "^5.0.0", - "wcwidth": "^1.0.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/ora/node_modules/ansi-regex": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "engines": { - "node": ">=6" - } - }, - "node_modules/ora/node_modules/strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -1703,18 +1602,6 @@ "node": ">=4" } }, - "node_modules/restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha512-6IzJLuGi4+R14vwagDHX+JrXmPVtPpn4mffDJ1UdR7/Edm87fl6yi8mMBIVvFtJaNTUvjughmW4hwLhRG7gC1Q==", - "dependencies": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -1832,11 +1719,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" - }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -1974,6 +1856,7 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, "dependencies": { "has-flag": "^3.0.0" }, @@ -2129,14 +2012,6 @@ "node": ">= 10.0.0" } }, - "node_modules/wcwidth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", - "dependencies": { - "defaults": "^1.0.3" - } - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/package.json b/package.json index 03ac766..d7fc1af 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "dotenv": "^16.3.1", "emoji-regex": "^10.3.0", "js-yaml": "^4.1.0", - "mongodb": "^6.3.0", - "ora": "^3.2.0" + "mongodb": "^6.3.0" } } diff --git a/src/core/deploy-commands.ts b/src/core/deploy-commands.ts index ca674d4..c45044d 100644 --- a/src/core/deploy-commands.ts +++ b/src/core/deploy-commands.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import path from 'path'; import { SlashCommandBuilder, REST, Routes, Collection, Snowflake } from 'discord.js'; -import { ansi, logging, spinner } from './utilities'; +import { ansi, logging } from './utilities'; const loggingConfig = loadYaml("bot/logging.yml") interface Command { @@ -65,15 +65,12 @@ export async function getCommands() { export async function deployCommands() { const rest = new REST().setToken(process.env.token); - let spin = spinner("Clearing global commands cache...", "blue") try { await rest.put(Routes.applicationCommands(process.env.clientId), { body: [] }) - spin.stop() logging("Cleared global commands cache!", "success") } catch (error) { - spin.stop() logging("An error occured when trying to clear the global commands cache\n" + error, "error") } @@ -105,7 +102,6 @@ export async function deployCommands() { } } // Reload guild commands - spin = spinner(`(/) Reloading commands for ${guildCommands.size} guilds...`,"yellow") guildCommands.forEach(async (guildCmd, guildId: string) => { try { console.log(guildCmd) @@ -113,24 +109,18 @@ export async function deployCommands() { body: guildCmd }) } catch (error) { - spin.clear() logging(`(/) Exception occured while refreshing commands for "${guildId}":\n${error}`, "error") - spin.render() } }) - spin.stop() logging(`(/) Reloaded guild-specific commands for ${guildCommands.size} guilds.`,"success") // Reload global commands - spin = spinner(`(/) Reloading ${globalCommands.length} global commands`, "yellow") try { const data = await rest.put(Routes.applicationCommands(process.env.clientId), { body: globalCommands }) - spin.stop() logging(`(/) Reloaded ${globalCommands.length} global commands`, "success") } catch (error) { - spin.stop() logging(`(/) Exception occured while reloading the global commands:\n${error}`, "error") } } \ No newline at end of file diff --git a/src/core/utilities.ts b/src/core/utilities.ts index 86e34f3..ede06c9 100644 --- a/src/core/utilities.ts +++ b/src/core/utilities.ts @@ -1,5 +1,3 @@ -import ora from "ora" -import { Color, Ora } from "ora" import { Console } from "console" import path from "path" import fs from "fs" @@ -62,33 +60,6 @@ export const ansi = (inputString) => colors[colorName.toLowerCase()] ? colors[colorName.toLowerCase()] : match ); -export function spinner(text: string, color: Color): Ora { - const spin = ora({ text: text }) - spin.color = color - spin.spinner = { - interval: 80, - frames: [ - "[ ]", - "[= ]", - "[== ]", - "[=== ]", - "[====]", - "[ ===]", - "[ ==]", - "[ =]", - "[ ]", - "[ =]", - "[ ==]", - "[ ===]", - "[====]", - "[=== ]", - "[== ]", - "[= ]" - ] - } - return spin -} - type LoggingType = | "info" | "success" diff --git a/src/index.ts b/src/index.ts index e585a3d..b71e610 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import "@core/globals" import 'dotenv/config' // File imports -import { ansi, spinner, logging } from "@core/utilities" +import { ansi, logging } from "@core/utilities" import { deployCommands, getCommands } from "@core/deploy-commands" import { initEvents } from "./core/events" import { alert } from "./alerts/hander" @@ -19,9 +19,8 @@ const client = new Client({intents: [GatewayIntentBits.Guilds]}); client.commands = await getCommands() })() -let spin = spinner("Initializing Client","yellow").start() client.once(Events.ClientReady, async(c) => { - spin.stop() + logging("Init. Client...","info") logging(ansi(`Logged in as %bold%${c.user.tag}%end%%light_green%!%end%`),"success"); logging(`Initalizing Events...`,"info") await initEvents(c)