From 6ed91fe43bc668005c7ba9e7e25e45441b1487bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Wed, 1 Sep 2021 12:41:46 +0300 Subject: [PATCH 01/40] Updated Dependencies --- package-lock.json | 154 +++++++++++++++++++++++++++++++++++++++------- package.json | 4 +- 2 files changed, 134 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5cd8779..bc6db79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "eximiabots-radiox", - "version": "0.3.0", + "version": "0.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "eximiabots-radiox", - "version": "0.3.0", + "version": "0.3.1", "license": "MIT", "dependencies": { "@discordjs/builders": "^0.6.0", @@ -17,7 +17,7 @@ "discord.js": "^13.1.0", "dotenv": "^10.0.0", "libsodium-wrappers": "^0.7.9", - "node-fetch": "^2.6.1", + "node-fetch": "^3.0.0", "path": "^0.12.7" }, "devDependencies": { @@ -220,6 +220,14 @@ "node-pre-gyp": "bin/node-pre-gyp" } }, + "node_modules/@discordjs/node-pre-gyp/node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, "node_modules/@discordjs/opus": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/@discordjs/opus/-/opus-0.6.0.tgz", @@ -251,6 +259,14 @@ "node": ">=16.0.0" } }, + "node_modules/@discordjs/rest/node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, "node_modules/@discordjs/voice": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.6.0.tgz", @@ -460,9 +476,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.7.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.8.tgz", - "integrity": "sha512-8upnoQU0OPzbIkm+ZMM0zCeFCkw2s3mS0IWdx0+AAaWqm4fkBb0UJp8Edl7FVKRamYbpJC/aVsHpKWBIbiC7Zg==" + "version": "16.7.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz", + "integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA==" }, "node_modules/@types/ws": { "version": "7.4.7", @@ -1159,9 +1175,9 @@ "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, "node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "node_modules/create-require": { "version": "1.1.1", @@ -1192,6 +1208,14 @@ "node": ">=8" } }, + "node_modules/data-uri-to-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz", + "integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==", + "engines": { + "node": ">= 6" + } + }, "node_modules/debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -1329,6 +1353,14 @@ "npm": ">=7.0.0" } }, + "node_modules/discord.js/node_modules/node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "engines": { + "node": "4.x || >=6.0.0" + } + }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -1745,6 +1777,27 @@ "reusify": "^1.0.4" } }, + "node_modules/fetch-blob": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.2.tgz", + "integrity": "sha512-hunJbvy/6OLjCD0uuhLdp0mMPzP/yd2ssd1t2FCJsaA7wkWhpbp9xfuNVpv7Ll4jFhzp6T4LAupSiV9uOeg0VQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -2542,11 +2595,19 @@ "dev": true }, "node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz", + "integrity": "sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==", + "dependencies": { + "data-uri-to-buffer": "^3.0.1", + "fetch-blob": "^3.1.2" + }, "engines": { - "node": "4.x || >=6.0.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" } }, "node_modules/nodemon": { @@ -3782,6 +3843,14 @@ "node": ">=0.10.0" } }, + "node_modules/web-streams-polyfill": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.1.0.tgz", + "integrity": "sha512-wO9r1YnYe7kFBLHyyVEhV1H8VRWoNiNnuP+v/HUUmSTaRF8F93Kmd3JMrETx0f11GXxRek6OcL2QtjFIdc5WYw==", + "engines": { + "node": ">= 8" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4057,6 +4126,13 @@ "rimraf": "^3.0.2", "semver": "^7.3.5", "tar": "^6.1.8" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + } } }, "@discordjs/opus": { @@ -4081,6 +4157,13 @@ "form-data": "^4.0.0", "node-fetch": "^2.6.1", "tslib": "^2.3.0" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + } } }, "@discordjs/voice": { @@ -4236,9 +4319,9 @@ "dev": true }, "@types/node": { - "version": "16.7.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.8.tgz", - "integrity": "sha512-8upnoQU0OPzbIkm+ZMM0zCeFCkw2s3mS0IWdx0+AAaWqm4fkBb0UJp8Edl7FVKRamYbpJC/aVsHpKWBIbiC7Zg==" + "version": "16.7.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.10.tgz", + "integrity": "sha512-S63Dlv4zIPb8x6MMTgDq5WWRJQe56iBEY0O3SOFA9JrRienkOVDXSXBjjJw6HTNQYSE2JI6GMCR6LVbIMHJVvA==" }, "@types/ws": { "version": "7.4.7", @@ -4741,9 +4824,9 @@ "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" }, "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "create-require": { "version": "1.1.1", @@ -4768,6 +4851,11 @@ "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "dev": true }, + "data-uri-to-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz", + "integrity": "sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og==" + }, "debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -4864,6 +4952,11 @@ "ts-mixer": "^6.0.0", "tslib": "^2.3.0" } + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" } } }, @@ -5182,6 +5275,14 @@ "reusify": "^1.0.4" } }, + "fetch-blob": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.2.tgz", + "integrity": "sha512-hunJbvy/6OLjCD0uuhLdp0mMPzP/yd2ssd1t2FCJsaA7wkWhpbp9xfuNVpv7Ll4jFhzp6T4LAupSiV9uOeg0VQ==", + "requires": { + "web-streams-polyfill": "^3.0.3" + } + }, "file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -5806,9 +5907,13 @@ "dev": true }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0.tgz", + "integrity": "sha512-bKMI+C7/T/SPU1lKnbQbwxptpCrG9ashG+VkytmXCPZyuM9jB6VU+hY0oi4lC8LxTtAeWdckNCTa3nrGsAdA3Q==", + "requires": { + "data-uri-to-buffer": "^3.0.1", + "fetch-blob": "^3.1.2" + } }, "nodemon": { "version": "2.0.12", @@ -6723,6 +6828,11 @@ "resolved": "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz", "integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=" }, + "web-streams-polyfill": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.1.0.tgz", + "integrity": "sha512-wO9r1YnYe7kFBLHyyVEhV1H8VRWoNiNnuP+v/HUUmSTaRF8F93Kmd3JMrETx0f11GXxRek6OcL2QtjFIdc5WYw==" + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 199433f..dd11b51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eximiabots-radiox", - "version": "0.3.0", + "version": "0.3.1", "description": "Internet Radio to your Discord guild", "main": "index.js", "scripts": { @@ -26,7 +26,7 @@ "discord.js": "^13.1.0", "dotenv": "^10.0.0", "libsodium-wrappers": "^0.7.9", - "node-fetch": "^2.6.1", + "node-fetch": "^3.0.0", "path": "^0.12.7" }, "devDependencies": { From a1aa96fc2fcbea613e0e6fbe2a495506b7c57c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Wed, 1 Sep 2021 12:51:17 +0300 Subject: [PATCH 02/40] Added radio.message?.delete in voiceStateUpdate --- src/client/events/voiceStateUpdate.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/events/voiceStateUpdate.js b/src/client/events/voiceStateUpdate.js index 1ae0fa1..e6da785 100644 --- a/src/client/events/voiceStateUpdate.js +++ b/src/client/events/voiceStateUpdate.js @@ -17,6 +17,7 @@ module.exports = { client.funcs.statisticsUpdate(client, newState.guild, radio); radio.connection?.destroy(); radio.audioPlayer?.stop(); + radio.message?.delete(); client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id); return client.radio.delete(newState.guild.id); } @@ -39,6 +40,7 @@ module.exports = { client.funcs.statisticsUpdate(client, newState.guild, radio); radio.connection?.destroy(); radio.audioPlayer?.stop(); + radio.message?.delete(); client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id); client.radio.delete(oldState.guild.id); } @@ -58,6 +60,7 @@ module.exports = { client.funcs.statisticsUpdate(client, newState.guild, radio); radio.connection?.destroy(); radio.audioPlayer?.stop(); + radio.message?.delete(); client.funcs.logger('Radio', 'Stream stopped' + " / " + newState.guild.id); client.radio.delete(newState.guild.id); } From 0858f9e49e1fd5cd20e465230bc3a1284d064d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Wed, 1 Sep 2021 13:56:54 +0300 Subject: [PATCH 03/40] Updated invite link --- src/client/commands/invite.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/commands/invite.js b/src/client/commands/invite.js index 83b51a0..3158dc3 100644 --- a/src/client/commands/invite.js +++ b/src/client/commands/invite.js @@ -11,7 +11,7 @@ module.exports = { const embed = new Discord.MessageEmbed() .setTitle(message.inviteTitle) .setColor(client.config.embedColor) - .setURL("https://discordapp.com/api/oauth2/authorize?client_id=" + client.user.id + "&permissions=2184465408&scope=applications.commands%20bot") //View Channels, Send Messages, Embed Links, Use External Emojis, Use Slash Commands, Connect, Speak, Use Voice Activity + .setURL("https://discord.com/api/oauth2/authorize?client_id=" + client.user.id + "&permissions=2184465408&scope=applications.commands%20bot") //View Channels, Send Messages, Embed Links, Use External Emojis, Use Slash Commands, Connect, Speak, Use Voice Activity .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); interaction.reply({ From 40879c85bb7252c67b169ab78f73d5bb23974150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Wed, 1 Sep 2021 17:47:12 +0300 Subject: [PATCH 04/40] Example solutions but dont work due to typescript --- src/client/events/ready.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/events/ready.js b/src/client/events/ready.js index 2213918..3f051ac 100644 --- a/src/client/events/ready.js +++ b/src/client/events/ready.js @@ -1,4 +1,4 @@ -const fetch = require('node-fetch'); +const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); module.exports = { name: 'ready', From 73857c9fc596fb13a36b11126bb74297f96c0273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 3 Sep 2021 05:31:02 +0300 Subject: [PATCH 05/40] Bumb Version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index ff815db..0707591 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "eximiabots-radiox", - "version": "0.3.2", + "version": "0.3.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "eximiabots-radiox", - "version": "0.3.2", + "version": "0.3.5", "license": "MIT", "dependencies": { "@discordjs/builders": "^0.6.0", diff --git a/package.json b/package.json index 56e9da6..33ba2e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eximiabots-radiox", - "version": "0.3.2", + "version": "0.3.5", "description": "Internet Radio to your Discord guild", "main": "index.js", "scripts": { From 190852bc164d61c86760cba17c4951bca051feb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sat, 4 Sep 2021 13:46:10 +0300 Subject: [PATCH 06/40] Bumb version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0707591..10fb9ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "eximiabots-radiox", - "version": "0.3.5", + "version": "0.3.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "eximiabots-radiox", - "version": "0.3.5", + "version": "0.3.10", "license": "MIT", "dependencies": { "@discordjs/builders": "^0.6.0", diff --git a/package.json b/package.json index 33ba2e6..12182d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eximiabots-radiox", - "version": "0.3.5", + "version": "0.3.10", "description": "Internet Radio to your Discord guild", "main": "index.js", "scripts": { From 9408d0d66ba39b848421f4de3486a0fa63e5c75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Tue, 7 Sep 2021 15:49:13 +0300 Subject: [PATCH 07/40] Bumb version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d9ffb9c..effd078 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "eximiabots-radiox", - "version": "0.3.7", + "version": "0.3.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "eximiabots-radiox", - "version": "0.3.7", + "version": "0.3.8", "license": "MIT", "dependencies": { "@discordjs/builders": "^0.6.0", diff --git a/package.json b/package.json index 6f80f33..c61e5d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eximiabots-radiox", - "version": "0.3.7", + "version": "0.3.8", "description": "Internet Radio to your Discord guild", "main": "index.js", "scripts": { From ac323a541072dd9d2893bb523bd4c130ce848891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Wed, 8 Sep 2021 01:39:35 +0300 Subject: [PATCH 08/40] Temporary solution --- package-lock.json | 48 +++++++++++++++--------------- src/client/commands/maintenance.js | 3 +- src/client/events/ready.js | 3 +- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/package-lock.json b/package-lock.json index 51b35c3..6dc8e6e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -221,9 +221,9 @@ } }, "node_modules/@discordjs/node-pre-gyp/node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.2.tgz", + "integrity": "sha512-aLoxToI6RfZ+0NOjmWAgn9+LEd30YCkJKFSyWacNZdEKTit/ZMcKjGkTRo8uWEsnIb/hfKecNPEbln02PdWbcA==", "engines": { "node": "4.x || >=6.0.0" } @@ -260,9 +260,9 @@ } }, "node_modules/@discordjs/rest/node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.2.tgz", + "integrity": "sha512-aLoxToI6RfZ+0NOjmWAgn9+LEd30YCkJKFSyWacNZdEKTit/ZMcKjGkTRo8uWEsnIb/hfKecNPEbln02PdWbcA==", "engines": { "node": "4.x || >=6.0.0" } @@ -1352,9 +1352,9 @@ } }, "node_modules/discord.js/node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.2.tgz", + "integrity": "sha512-aLoxToI6RfZ+0NOjmWAgn9+LEd30YCkJKFSyWacNZdEKTit/ZMcKjGkTRo8uWEsnIb/hfKecNPEbln02PdWbcA==", "engines": { "node": "4.x || >=6.0.0" } @@ -3845,9 +3845,9 @@ } }, "node_modules/web-streams-polyfill": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.1.0.tgz", - "integrity": "sha512-wO9r1YnYe7kFBLHyyVEhV1H8VRWoNiNnuP+v/HUUmSTaRF8F93Kmd3JMrETx0f11GXxRek6OcL2QtjFIdc5WYw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.1.1.tgz", + "integrity": "sha512-Czi3fG883e96T4DLEPRvufrF2ydhOOW1+1a6c3gNjH2aIh50DNFBdfwh2AKoOf1rXvpvavAoA11Qdq9+BKjE0Q==", "engines": { "node": ">= 8" } @@ -4130,9 +4130,9 @@ }, "dependencies": { "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.2.tgz", + "integrity": "sha512-aLoxToI6RfZ+0NOjmWAgn9+LEd30YCkJKFSyWacNZdEKTit/ZMcKjGkTRo8uWEsnIb/hfKecNPEbln02PdWbcA==" } } }, @@ -4161,9 +4161,9 @@ }, "dependencies": { "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.2.tgz", + "integrity": "sha512-aLoxToI6RfZ+0NOjmWAgn9+LEd30YCkJKFSyWacNZdEKTit/ZMcKjGkTRo8uWEsnIb/hfKecNPEbln02PdWbcA==" } } }, @@ -4950,9 +4950,9 @@ } }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.2.tgz", + "integrity": "sha512-aLoxToI6RfZ+0NOjmWAgn9+LEd30YCkJKFSyWacNZdEKTit/ZMcKjGkTRo8uWEsnIb/hfKecNPEbln02PdWbcA==" } } }, @@ -6811,9 +6811,9 @@ "integrity": "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=" }, "web-streams-polyfill": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.1.0.tgz", - "integrity": "sha512-wO9r1YnYe7kFBLHyyVEhV1H8VRWoNiNnuP+v/HUUmSTaRF8F93Kmd3JMrETx0f11GXxRek6OcL2QtjFIdc5WYw==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.1.1.tgz", + "integrity": "sha512-Czi3fG883e96T4DLEPRvufrF2ydhOOW1+1a6c3gNjH2aIh50DNFBdfwh2AKoOf1rXvpvavAoA11Qdq9+BKjE0Q==" }, "which": { "version": "2.0.2", diff --git a/src/client/commands/maintenance.js b/src/client/commands/maintenance.js index 86f23e9..c39f999 100644 --- a/src/client/commands/maintenance.js +++ b/src/client/commands/maintenance.js @@ -1,5 +1,6 @@ import Discord from "discord.js"; -import fetch from "node-fetch"; +const _importDynamic = new Function('modulePath', 'return import(modulePath)'); +const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args)); module.exports = { name: 'maintenance', diff --git a/src/client/events/ready.js b/src/client/events/ready.js index b712155..131ab27 100644 --- a/src/client/events/ready.js +++ b/src/client/events/ready.js @@ -1,5 +1,6 @@ import Datastore from "../datastore.js"; -const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args)); +const _importDynamic = new Function('modulePath', 'return import(modulePath)'); +const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args)); module.exports = { name: 'ready', From 7699871779d9bdbedc53c9d66e002a56b95a4275 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Sep 2021 08:02:48 +0000 Subject: [PATCH 09/40] Bump discord-api-types from 0.22.0 to 0.23.0 Bumps [discord-api-types](https://github.com/discordjs/discord-api-types) from 0.22.0 to 0.23.0. - [Release notes](https://github.com/discordjs/discord-api-types/releases) - [Changelog](https://github.com/discordjs/discord-api-types/blob/main/CHANGELOG.md) - [Commits](https://github.com/discordjs/discord-api-types/compare/0.22.0...0.23.0) --- updated-dependencies: - dependency-name: discord-api-types dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 70 ++++++++++++++++++++++++++++++++++++++++++----- package.json | 2 +- 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index effd078..441df70 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@discordjs/opus": "^0.6.0", "@discordjs/rest": "^0.1.1-canary.0", "@discordjs/voice": "^0.6.0", - "discord-api-types": "^0.22.0", + "discord-api-types": "^0.23.0", "discord.js": "^13.1.0", "dotenv": "^10.0.0", "libsodium-wrappers": "^0.7.9", @@ -180,6 +180,14 @@ "npm": ">=7.0.0" } }, + "node_modules/@discordjs/builders/node_modules/discord-api-types": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", + "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==", + "engines": { + "node": ">=12" + } + }, "node_modules/@discordjs/collection": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.2.1.tgz", @@ -251,6 +259,14 @@ "node": ">=16.0.0" } }, + "node_modules/@discordjs/rest/node_modules/discord-api-types": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", + "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==", + "engines": { + "node": ">=12" + } + }, "node_modules/@discordjs/voice": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.6.0.tgz", @@ -281,6 +297,14 @@ "node": ">=12.0.0" } }, + "node_modules/@discordjs/voice/node_modules/discord-api-types": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", + "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==", + "engines": { + "node": ">=12" + } + }, "node_modules/@discordjs/voice/node_modules/node-addon-api": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", @@ -1285,9 +1309,9 @@ } }, "node_modules/discord-api-types": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", - "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.23.0.tgz", + "integrity": "sha512-o/RnhlC59Km+iMzuVDoneVOi+TFkgDKiOYjHYDt2Epv6yRJJESajkQIbrio+zjEBlrnp3JgdyF5YjEAEpezUxw==", "engines": { "node": ">=12" } @@ -1327,6 +1351,14 @@ "npm": ">=7.0.0" } }, + "node_modules/discord.js/node_modules/discord-api-types": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", + "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==", + "engines": { + "node": ">=12" + } + }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -4027,6 +4059,13 @@ "ow": "^0.27.0", "ts-mixer": "^6.0.0", "tslib": "^2.3.1" + }, + "dependencies": { + "discord-api-types": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", + "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==" + } } }, "@discordjs/collection": { @@ -4082,6 +4121,13 @@ "form-data": "^4.0.0", "node-fetch": "^2.6.1", "tslib": "^2.3.0" + }, + "dependencies": { + "discord-api-types": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", + "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==" + } } }, "@discordjs/voice": { @@ -4107,6 +4153,11 @@ "node-addon-api": "^3.2.1" } }, + "discord-api-types": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", + "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==" + }, "node-addon-api": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", @@ -4830,9 +4881,9 @@ } }, "discord-api-types": { - "version": "0.22.0", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", - "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==" + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.23.0.tgz", + "integrity": "sha512-o/RnhlC59Km+iMzuVDoneVOi+TFkgDKiOYjHYDt2Epv6yRJJESajkQIbrio+zjEBlrnp3JgdyF5YjEAEpezUxw==" }, "discord.js": { "version": "13.1.0", @@ -4860,6 +4911,11 @@ "ts-mixer": "^6.0.0", "tslib": "^2.3.0" } + }, + "discord-api-types": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.22.0.tgz", + "integrity": "sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==" } } }, diff --git a/package.json b/package.json index c61e5d8..edfd744 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@discordjs/opus": "^0.6.0", "@discordjs/rest": "^0.1.1-canary.0", "@discordjs/voice": "^0.6.0", - "discord-api-types": "^0.22.0", + "discord-api-types": "^0.23.0", "discord.js": "^13.1.0", "dotenv": "^10.0.0", "libsodium-wrappers": "^0.7.9", From 46790b12fff3ffd9c3bbfab7febba28e76b7bc39 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Sep 2021 08:02:40 +0000 Subject: [PATCH 10/40] Bump @types/node from 16.7.13 to 16.9.0 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 16.7.13 to 16.9.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) --- updated-dependencies: - dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 441df70..022aa3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "path": "^0.12.7" }, "devDependencies": { - "@types/node": "^16.7.13", + "@types/node": "^16.9.0", "@types/ws": "^7.4.7", "@typescript-eslint/eslint-plugin": "^4.31.0", "@typescript-eslint/parser": "^4.31.0", @@ -484,9 +484,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.7.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.13.tgz", - "integrity": "sha512-pLUPDn+YG3FYEt/pHI74HmnJOWzeR+tOIQzUx93pi9M7D8OE7PSLr97HboXwk5F+JS+TLtWuzCOW97AHjmOXXA==" + "version": "16.9.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.0.tgz", + "integrity": "sha512-nmP+VR4oT0pJUPFbKE4SXj3Yb4Q/kz3M9dSAO1GGMebRKWHQxLfDNmU/yh3xxCJha3N60nQ/JwXWwOE/ZSEVag==" }, "node_modules/@types/ws": { "version": "7.4.7", @@ -4288,9 +4288,9 @@ "dev": true }, "@types/node": { - "version": "16.7.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.13.tgz", - "integrity": "sha512-pLUPDn+YG3FYEt/pHI74HmnJOWzeR+tOIQzUx93pi9M7D8OE7PSLr97HboXwk5F+JS+TLtWuzCOW97AHjmOXXA==" + "version": "16.9.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.0.tgz", + "integrity": "sha512-nmP+VR4oT0pJUPFbKE4SXj3Yb4Q/kz3M9dSAO1GGMebRKWHQxLfDNmU/yh3xxCJha3N60nQ/JwXWwOE/ZSEVag==" }, "@types/ws": { "version": "7.4.7", diff --git a/package.json b/package.json index edfd744..a58970c 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "path": "^0.12.7" }, "devDependencies": { - "@types/node": "^16.7.13", + "@types/node": "^16.9.0", "@types/ws": "^7.4.7", "@typescript-eslint/eslint-plugin": "^4.31.0", "@typescript-eslint/parser": "^4.31.0", From ddbe950a1992fe6ce900d3b5cbc45c9ff0132cf4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Sep 2021 08:02:59 +0000 Subject: [PATCH 11/40] Bump discord-api-types from 0.23.0 to 0.23.1 Bumps [discord-api-types](https://github.com/discordjs/discord-api-types) from 0.23.0 to 0.23.1. - [Release notes](https://github.com/discordjs/discord-api-types/releases) - [Changelog](https://github.com/discordjs/discord-api-types/blob/main/CHANGELOG.md) - [Commits](https://github.com/discordjs/discord-api-types/compare/0.23.0...0.23.1) --- updated-dependencies: - dependency-name: discord-api-types dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 441df70..702d31b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@discordjs/opus": "^0.6.0", "@discordjs/rest": "^0.1.1-canary.0", "@discordjs/voice": "^0.6.0", - "discord-api-types": "^0.23.0", + "discord-api-types": "^0.23.1", "discord.js": "^13.1.0", "dotenv": "^10.0.0", "libsodium-wrappers": "^0.7.9", @@ -1309,9 +1309,9 @@ } }, "node_modules/discord-api-types": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.23.0.tgz", - "integrity": "sha512-o/RnhlC59Km+iMzuVDoneVOi+TFkgDKiOYjHYDt2Epv6yRJJESajkQIbrio+zjEBlrnp3JgdyF5YjEAEpezUxw==", + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.23.1.tgz", + "integrity": "sha512-igWmn+45mzXRWNEPU25I/pr8MwxHb767wAr51oy3VRLRcTlp5ADBbrBR0lq3SA1Rfw3MtM4TQu1xo3kxscfVdQ==", "engines": { "node": ">=12" } @@ -4881,9 +4881,9 @@ } }, "discord-api-types": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.23.0.tgz", - "integrity": "sha512-o/RnhlC59Km+iMzuVDoneVOi+TFkgDKiOYjHYDt2Epv6yRJJESajkQIbrio+zjEBlrnp3JgdyF5YjEAEpezUxw==" + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.23.1.tgz", + "integrity": "sha512-igWmn+45mzXRWNEPU25I/pr8MwxHb767wAr51oy3VRLRcTlp5ADBbrBR0lq3SA1Rfw3MtM4TQu1xo3kxscfVdQ==" }, "discord.js": { "version": "13.1.0", diff --git a/package.json b/package.json index edfd744..4c0ecd9 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@discordjs/opus": "^0.6.0", "@discordjs/rest": "^0.1.1-canary.0", "@discordjs/voice": "^0.6.0", - "discord-api-types": "^0.23.0", + "discord-api-types": "^0.23.1", "discord.js": "^13.1.0", "dotenv": "^10.0.0", "libsodium-wrappers": "^0.7.9", From 24716dd49793b9d2f9e2121a908cba6bbbf7ae68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 11:26:37 +0300 Subject: [PATCH 12/40] Updated Dependencies --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 11d391a..0df6429 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3906,9 +3906,9 @@ } }, "node_modules/ws": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.4.tgz", - "integrity": "sha512-zP9z6GXm6zC27YtspwH99T3qTG7bBFv2VIkeHstMLrLlDJuzA7tQ5ls3OJ1hOGGCzTQPniNJoHXIAOS0Jljohg==", + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", + "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==", "engines": { "node": ">=8.3.0" }, @@ -6836,9 +6836,9 @@ } }, "ws": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.4.tgz", - "integrity": "sha512-zP9z6GXm6zC27YtspwH99T3qTG7bBFv2VIkeHstMLrLlDJuzA7tQ5ls3OJ1hOGGCzTQPniNJoHXIAOS0Jljohg==", + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", + "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==", "requires": {} }, "xdg-basedir": { From 90a93d35f7fb17d16ebc1c6e3c16bab28008d58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 12:05:15 +0300 Subject: [PATCH 13/40] Removed comments in maintenance.js --- src/client/commands/maintenance.js | 41 ------------------------------ 1 file changed, 41 deletions(-) diff --git a/src/client/commands/maintenance.js b/src/client/commands/maintenance.js index 86f23e9..2758a0b 100644 --- a/src/client/commands/maintenance.js +++ b/src/client/commands/maintenance.js @@ -132,46 +132,5 @@ module.exports = { } - - /* - if(!client.stations) { - message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); - return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist); - } - - let currentRadios = client.radio.keys(); - let radio = currentRadios.next(); - let stoppedRadios = ""; - - client.user.setStatus('dnd'); - - while (!radio.done) { - let currentRadio = client.radio.get(radio.value); - currentRadio.guild = client.datastore.getEntry(radio.value).guild; - - if(currentRadio){ - client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio); - currentRadio.connection?.destroy(); - currentRadio.audioPlayer?.stop(); - currentRadio.message?.delete(); - client.radio.delete(radio.value); - stoppedRadios += "-" + radio.value + ": " + currentRadio.guild.name + "\n"; - } - radio = currentRadios.next(); - } - - const embed = new Discord.MessageEmbed() - .setTitle(client.messages.maintenanceTitle) - .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, '')) - .setColor(client.config.embedColor) - .setDescription("Stopped all radios" + "\n" + stoppedRadios) - .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') - .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); - - interaction.reply({ - embeds: [embed], - ephemeral: true - });*/ - } }; \ No newline at end of file From 0b1cb03305267332a06f131d16b865b6277f1270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 12:05:39 +0300 Subject: [PATCH 14/40] Added exit event in Client.ts --- src/Client.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Client.ts b/src/Client.ts index 761e7cd..8cc6647 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -89,6 +89,10 @@ class RadioClient extends Client { process.on('uncaughtException', (error) => { require(`${events}uncaughtException`).execute(this, error); }); + + process.on('exit', () => { + this.funcs.logger("Bot", "Stopping"); + }); this.on("error", error => { console.error(error); From 1bb8d8d80196401644ecbd17ea8f64c6588adc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 12:05:52 +0300 Subject: [PATCH 15/40] Updated SIGINT event --- src/client/events/SIGINT.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/client/events/SIGINT.js b/src/client/events/SIGINT.js index a63248a..bbfe0ed 100644 --- a/src/client/events/SIGINT.js +++ b/src/client/events/SIGINT.js @@ -3,10 +3,6 @@ module.exports = { execute(client) { client.user.setStatus('dnd'); - console.log("\n"); - client.funcs.logger("Bot", "Closing"); - console.log("\n"); - client.funcs.saveRadios(client); setInterval(() => { From c83b90aa207d6ffcfa434f5919d67ab9e0890063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 12:42:10 +0300 Subject: [PATCH 16/40] Removed .vscode folder in .gitignore --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c83c05a..26247f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ datastore/ node_modules/ npm-debug.log -.vscode/ .env -build/ \ No newline at end of file +build/ From b44bc679e534608a40e62d3fb83495b01f626250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 12:43:12 +0300 Subject: [PATCH 17/40] Added VSCode settings --- .vscode/settings.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..247bf3e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "editor.renderFinalNewline": false +} From 13814afebc7616d1745bd72dc136b2e880b80f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 12:44:50 +0300 Subject: [PATCH 18/40] Formatting changes --- .dockerignore | 2 +- .env_example | 2 +- .github/dependabot.yml | 2 +- .github/labeler.yml | 2 +- .github/workflows/docker-build.yml | 2 +- .github/workflows/labeler.yml | 2 +- Dockerfile | 2 +- package.json | 2 +- src/Client.ts | 8 ++++---- src/client/commands.js | 4 ++-- src/client/commands/bug.js | 2 +- src/client/commands/help.js | 2 +- src/client/commands/invite.js | 2 +- src/client/commands/list.js | 6 +++--- src/client/commands/maintenance.js | 8 ++++---- src/client/commands/next.js | 6 +++--- src/client/commands/nowplaying.js | 4 ++-- src/client/commands/play.js | 4 ++-- src/client/commands/prev.js | 6 +++--- src/client/commands/statistics.js | 6 +++--- src/client/commands/status.js | 2 +- src/client/commands/stop.js | 2 +- src/client/datastore.js | 20 ++++++++++---------- src/client/emojis.js | 2 +- src/client/events/SIGINT.js | 4 ++-- src/client/events/SIGTERM.js | 2 +- src/client/events/interactionCreate.js | 4 ++-- src/client/events/messageCreate.js | 6 +++--- src/client/events/messageDelete.js | 2 +- src/client/events/ready.js | 10 +++++----- src/client/events/uncaughtException.js | 2 +- src/client/funcs/checkFetchStatus.js | 2 +- src/client/funcs/isDev.js | 2 +- src/client/funcs/listStations.js | 2 +- src/client/funcs/loadState.js | 2 +- src/client/funcs/logger.js | 2 +- src/client/funcs/msToTime.js | 2 +- src/client/funcs/play.js | 8 ++++---- src/client/funcs/restoreRadios.js | 4 ++-- src/client/funcs/saveRadios.js | 8 ++++---- src/client/funcs/saveState.js | 4 ++-- src/client/funcs/searchStation.js | 2 +- src/client/funcs/statisticsUpdate.js | 12 ++++++------ src/client/messages.js | 2 +- src/client/utils/typings.ts | 2 +- src/config.js | 2 +- 46 files changed, 93 insertions(+), 93 deletions(-) diff --git a/.dockerignore b/.dockerignore index 7fa30a4..79ba2cd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,4 @@ datastore Dockerfile LICENSE -README.md \ No newline at end of file +README.md diff --git a/.env_example b/.env_example index e41c215..8ff64e7 100644 --- a/.env_example +++ b/.env_example @@ -1,2 +1,2 @@ DISCORD_TOKEN= -RADIOX_STATIONSLISTURL=https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json \ No newline at end of file +RADIOX_STATIONSLISTURL=https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6b1750e..091e06d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -16,4 +16,4 @@ updates: interval: "daily" target-branch: "develop" labels: - - "dependencies" \ No newline at end of file + - "dependencies" diff --git a/.github/labeler.yml b/.github/labeler.yml index 5b27493..43d4f25 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -4,4 +4,4 @@ dependencies: documentation: - README.md - LICENSE -- .env_example \ No newline at end of file +- .env_example diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 56eef1b..521a244 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -16,4 +16,4 @@ jobs: with: install: true - name: Build - run: docker build . # will run buildx \ No newline at end of file + run: docker build . # will run buildx diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index ba751b9..de18317 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -14,4 +14,4 @@ jobs: - uses: actions/labeler@v3 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" - sync-labels: true \ No newline at end of file + sync-labels: true diff --git a/Dockerfile b/Dockerfile index bcfb1fa..a052374 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,4 +14,4 @@ RUN npm install RUN npm run build -CMD [ "npm", "start" ] \ No newline at end of file +CMD [ "npm", "start" ] diff --git a/package.json b/package.json index 9184d59..e1efeea 100644 --- a/package.json +++ b/package.json @@ -48,4 +48,4 @@ "node": ">=16.8.0", "npm": ">=7.0.0" } -} \ No newline at end of file +} diff --git a/src/Client.ts b/src/Client.ts index 8cc6647..3bfdcc3 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -73,11 +73,11 @@ class RadioClient extends Client { this.on("interactionCreate", interaction => { require(`${events}interactionCreate`).execute(this, interaction); }); - + this.on("voiceStateUpdate", (oldState, newState) => { require(`${events}voiceStateUpdate`).execute(this, oldState, newState); }); - + process.on('SIGINT', () => { require(`${events}SIGINT`).execute(this); }); @@ -93,7 +93,7 @@ class RadioClient extends Client { process.on('exit', () => { this.funcs.logger("Bot", "Stopping"); }); - + this.on("error", error => { console.error(error); }); @@ -102,4 +102,4 @@ class RadioClient extends Client { } } -export default RadioClient \ No newline at end of file +export default RadioClient diff --git a/src/client/commands.js b/src/client/commands.js index 0d737d5..9641933 100644 --- a/src/client/commands.js +++ b/src/client/commands.js @@ -15,7 +15,7 @@ module.exports = { command.data = new SlashCommandBuilder() .setName(command.name) .setDescription(command.description); - + command.data = command.data.toJSON(); if(command.options) { command.options.forEach(function(option) { @@ -67,4 +67,4 @@ module.exports = { } })(); } -} \ No newline at end of file +} diff --git a/src/client/commands/bug.js b/src/client/commands/bug.js index 48091b1..26292d1 100644 --- a/src/client/commands/bug.js +++ b/src/client/commands/bug.js @@ -23,4 +23,4 @@ module.exports = { ephemeral: true }); } -}; \ No newline at end of file +}; diff --git a/src/client/commands/help.js b/src/client/commands/help.js index 212346b..52c4666 100644 --- a/src/client/commands/help.js +++ b/src/client/commands/help.js @@ -26,7 +26,7 @@ module.exports = { .setDescription(message.helpDescription) .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); - + interaction.reply({ embeds: [embed], ephemeral: true diff --git a/src/client/commands/invite.js b/src/client/commands/invite.js index 5c66601..c9f69a8 100644 --- a/src/client/commands/invite.js +++ b/src/client/commands/invite.js @@ -19,4 +19,4 @@ module.exports = { ephemeral: true }); } -}; \ No newline at end of file +}; diff --git a/src/client/commands/list.js b/src/client/commands/list.js index 5a18b64..47edaee 100644 --- a/src/client/commands/list.js +++ b/src/client/commands/list.js @@ -13,9 +13,9 @@ module.exports = { ephemeral: true }); } - + const radio = client.radio.get(interaction.guild.id); - + if(radio){ client.funcs.listStations(client, interaction); } else { @@ -39,4 +39,4 @@ module.exports = { }); } } -}; \ No newline at end of file +}; diff --git a/src/client/commands/maintenance.js b/src/client/commands/maintenance.js index 2758a0b..b4bc8ee 100644 --- a/src/client/commands/maintenance.js +++ b/src/client/commands/maintenance.js @@ -60,7 +60,7 @@ module.exports = { value: "9" } ); - + const menu = new Discord.MessageActionRow() .addComponents( new Discord.MessageSelectMenu() @@ -84,7 +84,7 @@ module.exports = { .setColor(client.config.embedColor) .setDescription(options.find(option => option.value == action).label) .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); - + interaction.reply({ embeds: [embed], ephemeral: true @@ -116,7 +116,7 @@ module.exports = { client.stations = await fetch(client.config.stationslistUrl) .then(client.funcs.checkFetchStatus) .then(response => response.json()); - + client.funcs.logger('Stations', 'Successfully fetched list'); } catch (error) { client.funcs.logger('Stations', 'Fetching list failed'); @@ -133,4 +133,4 @@ module.exports = { } } -}; \ No newline at end of file +}; diff --git a/src/client/commands/next.js b/src/client/commands/next.js index c4ae658..ab3a0f0 100644 --- a/src/client/commands/next.js +++ b/src/client/commands/next.js @@ -5,7 +5,7 @@ module.exports = { async execute(interaction, client, command) { if (client.funcs.check(client, interaction, command)) { const radio = client.radio.get(interaction.guild.id); - + let index = client.stations.findIndex(station => station.name == radio.station.name) + 1; if(index == client.stations.length) index = 0; @@ -20,7 +20,7 @@ module.exports = { client.funcs.statisticsUpdate(client, interaction.guild, radio); radio.audioPlayer.stop(); - + let date = new Date(); radio.station = station; radio.textChannel = interaction.channel; @@ -36,4 +36,4 @@ module.exports = { } } -} \ No newline at end of file +} diff --git a/src/client/commands/nowplaying.js b/src/client/commands/nowplaying.js index bf42da9..b863dc5 100644 --- a/src/client/commands/nowplaying.js +++ b/src/client/commands/nowplaying.js @@ -25,11 +25,11 @@ module.exports = { .setDescription(message.nowplayingDescription) .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); - + interaction.reply({ embeds: [embed], ephemeral: true }); } } -}; \ No newline at end of file +}; diff --git a/src/client/commands/play.js b/src/client/commands/play.js index fb29976..661a081 100644 --- a/src/client/commands/play.js +++ b/src/client/commands/play.js @@ -90,7 +90,7 @@ module.exports = { if (radio) { client.funcs.statisticsUpdate(client, interaction.guild, radio); radio.audioPlayer.stop(); - + let date = new Date(); radio.station = station; radio.textChannel = interaction.channel; @@ -141,4 +141,4 @@ module.exports = { }); } } -}; \ No newline at end of file +}; diff --git a/src/client/commands/prev.js b/src/client/commands/prev.js index df987b8..78ac583 100644 --- a/src/client/commands/prev.js +++ b/src/client/commands/prev.js @@ -20,12 +20,12 @@ module.exports = { client.funcs.statisticsUpdate(client, interaction.guild, radio); radio.audioPlayer.stop(); - + let date = new Date(); radio.station = station; radio.textChannel = interaction.channel; radio.startTime = date.getTime(); - + if(interaction.isCommand()) { client.funcs.play(interaction, interaction.guild, client, url); } @@ -36,4 +36,4 @@ module.exports = { } } -} \ No newline at end of file +} diff --git a/src/client/commands/statistics.js b/src/client/commands/statistics.js index df31e33..56c533c 100644 --- a/src/client/commands/statistics.js +++ b/src/client/commands/statistics.js @@ -11,7 +11,7 @@ module.exports = { let currentGuild = client.datastore.getEntry(interaction.guild.id); let global = client.datastore.getEntry("global"); let statistics = ""; - + if(!client.stations) { message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); return interaction.reply({ @@ -35,7 +35,7 @@ module.exports = { } }); } - + const embed = new Discord.MessageEmbed() .setTitle(client.messages.statisticsTitle) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, '')) @@ -49,4 +49,4 @@ module.exports = { ephemeral: true }); } -}; \ No newline at end of file +}; diff --git a/src/client/commands/status.js b/src/client/commands/status.js index c40fdbd..66eb727 100644 --- a/src/client/commands/status.js +++ b/src/client/commands/status.js @@ -28,4 +28,4 @@ module.exports = { }); } -}; \ No newline at end of file +}; diff --git a/src/client/commands/stop.js b/src/client/commands/stop.js index fbdb3e9..d457c99 100644 --- a/src/client/commands/stop.js +++ b/src/client/commands/stop.js @@ -38,4 +38,4 @@ module.exports = { }); } } -}; \ No newline at end of file +}; diff --git a/src/client/datastore.js b/src/client/datastore.js index dbacf73..4db0eee 100644 --- a/src/client/datastore.js +++ b/src/client/datastore.js @@ -6,7 +6,7 @@ module.exports = class { this.map = new Map(); this.loadData(); } - + loadData() { const dir = path.join(path.dirname(__dirname), '../datastore'); if (!fs.existsSync(dir)) { @@ -33,7 +33,7 @@ module.exports = class { var statistics = {}; if(!client.stations) return; - + let calculation = guilds.next(); while (!calculation.done) { @@ -47,7 +47,7 @@ module.exports = class { statistics[stations[station].name].time = 0; statistics[stations[station].name].used = 0; } - + statistics[stations[station].name].time = parseInt(statistics[stations[station].name].time)+parseInt(currentGuild.statistics[stations[station].name].time); statistics[stations[station].name].used = parseInt(statistics[stations[station].name].used)+parseInt(currentGuild.statistics[stations[station].name].used); } @@ -84,26 +84,26 @@ module.exports = class { this.map.set(id, newData); this.saveEntry(id, newData); } - + getEntry(id){ return this.map.get(id); } - + updateEntry(guild, newData) { newData.guild.name = guild.name; let date = new Date(); newData.updated = date.toISOString().substring(0, 10) - + this.map.set(guild.id, newData); this.saveEntry(guild.id, newData); //this.showEntry(this.getEntry(guild.id)); } - + showEntry(data){ console.log(data); } - + createTestFile () { let newData = { "guild": { @@ -120,10 +120,10 @@ module.exports = class { } } - + this.updateEntry(newData.guild, newData); } - + saveEntry(file, data) { data = JSON.stringify(data, null, 4); diff --git a/src/client/emojis.js b/src/client/emojis.js index 7e1fbbf..61af51a 100644 --- a/src/client/emojis.js +++ b/src/client/emojis.js @@ -39,4 +39,4 @@ module.exports = { } } } -} \ No newline at end of file +} diff --git a/src/client/events/SIGINT.js b/src/client/events/SIGINT.js index bbfe0ed..6445029 100644 --- a/src/client/events/SIGINT.js +++ b/src/client/events/SIGINT.js @@ -4,11 +4,11 @@ module.exports = { client.user.setStatus('dnd'); client.funcs.saveRadios(client); - + setInterval(() => { if(client.radio.size == 0){ process.exit(); } }, 500); } -} \ No newline at end of file +} diff --git a/src/client/events/SIGTERM.js b/src/client/events/SIGTERM.js index 99e7af3..62c4830 100644 --- a/src/client/events/SIGTERM.js +++ b/src/client/events/SIGTERM.js @@ -3,4 +3,4 @@ module.exports = { execute(client) { process.emit('SIGINT'); } -} \ No newline at end of file +} diff --git a/src/client/events/interactionCreate.js b/src/client/events/interactionCreate.js index 65d7168..4b37466 100644 --- a/src/client/events/interactionCreate.js +++ b/src/client/events/interactionCreate.js @@ -4,7 +4,7 @@ module.exports = { const permissions = interaction.channel.permissionsFor(interaction.client.user); if (!permissions.has('VIEW_CHANNEL')) return; - + if (!permissions.has('EMBED_LINKS')) return interaction.reply({ content: client.messages.noPermsEmbed, ephemeral: true @@ -14,7 +14,7 @@ module.exports = { const commandName = interaction.commandName; const command = client.commands.get(commandName); if (!command) return; - + try { command.execute(interaction, client); } catch (error) { diff --git a/src/client/events/messageCreate.js b/src/client/events/messageCreate.js index 0f8b9d6..939f6b1 100644 --- a/src/client/events/messageCreate.js +++ b/src/client/events/messageCreate.js @@ -16,7 +16,7 @@ module.exports = { } else { return; } - + const args = message.content.slice(prefix.length).split(' '); if (!message.content.startsWith(prefix)) return; if (!args[0]) return; @@ -30,7 +30,7 @@ module.exports = { let newMessage = {}; newMessage.messageCommandsDeprecatedTitle = client.messages.messageCommandsDeprecatedTitle.replace("%client.user.username%", client.user.username); - + const embed = new Discord.MessageEmbed() .setTitle(newMessage.messageCommandsDeprecatedTitle) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) @@ -55,4 +55,4 @@ module.exports = { console.error(error); } } -} \ No newline at end of file +} diff --git a/src/client/events/messageDelete.js b/src/client/events/messageDelete.js index 9cce584..ee54793 100644 --- a/src/client/events/messageDelete.js +++ b/src/client/events/messageDelete.js @@ -7,4 +7,4 @@ module.exports = { if(msg.id != radio.message.id) return; radio.message = null; } -} \ No newline at end of file +} diff --git a/src/client/events/ready.js b/src/client/events/ready.js index 848885e..76c1ffa 100644 --- a/src/client/events/ready.js +++ b/src/client/events/ready.js @@ -21,7 +21,7 @@ module.exports = { /*DEVELOPERS*/ client.funcs.logger('Developers'); - + client.developers = ""; let user = ""; for (let i = 0; i < client.config.devId.length; i++) { @@ -53,7 +53,7 @@ module.exports = { client.funcs.logger('Stations', 'Fetching list failed'); console.error(error + "\n"); } - + setInterval(async () => { try { client.funcs.logger('Stations', 'Started fetching list – ' + client.config.stationslistUrl); @@ -71,7 +71,7 @@ module.exports = { if(!client.stations) { client.user.setStatus('dnd'); } - + /*GUILDS*/ client.funcs.logger('Guilds', 'Started fetching list'); @@ -83,7 +83,7 @@ module.exports = { console.log("\n"); client.funcs.logger('Guilds', 'Successfully fetched list'); - + /*STATISTICS*/ client.datastore.calculateGlobal(client); @@ -99,4 +99,4 @@ module.exports = { }, 5000); } -} \ No newline at end of file +} diff --git a/src/client/events/uncaughtException.js b/src/client/events/uncaughtException.js index 5df8a0b..ba3d8ac 100644 --- a/src/client/events/uncaughtException.js +++ b/src/client/events/uncaughtException.js @@ -4,4 +4,4 @@ module.exports = { console.log(error.stack); process.emit('SIGINT'); } -} \ No newline at end of file +} diff --git a/src/client/funcs/checkFetchStatus.js b/src/client/funcs/checkFetchStatus.js index 3b6c371..4774d77 100644 --- a/src/client/funcs/checkFetchStatus.js +++ b/src/client/funcs/checkFetchStatus.js @@ -4,4 +4,4 @@ module.exports = function (response) { } else { throw new Error(response.status + " " + response.statusText); } -} \ No newline at end of file +} diff --git a/src/client/funcs/isDev.js b/src/client/funcs/isDev.js index 39e98f8..3992c1e 100644 --- a/src/client/funcs/isDev.js +++ b/src/client/funcs/isDev.js @@ -7,4 +7,4 @@ module.exports = function (devList, authorID){ } }); return response; -} \ No newline at end of file +} diff --git a/src/client/funcs/listStations.js b/src/client/funcs/listStations.js index 6befe09..d0cb036 100644 --- a/src/client/funcs/listStations.js +++ b/src/client/funcs/listStations.js @@ -30,4 +30,4 @@ module.exports = function (client, interaction){ components: [menu], ephemeral: true }); -} \ No newline at end of file +} diff --git a/src/client/funcs/loadState.js b/src/client/funcs/loadState.js index f7ff54b..676685e 100644 --- a/src/client/funcs/loadState.js +++ b/src/client/funcs/loadState.js @@ -7,4 +7,4 @@ module.exports = function loadState(client, guild){ data.state = {}; client.datastore.updateEntry(guild, data); return state; -} \ No newline at end of file +} diff --git a/src/client/funcs/logger.js b/src/client/funcs/logger.js index 80ce35c..610fdc5 100644 --- a/src/client/funcs/logger.js +++ b/src/client/funcs/logger.js @@ -2,4 +2,4 @@ module.exports = function (area, text){ let date = new Date(); console.log('[' + area + '] – ' + date.toISOString()); if(text) console.log(text + '\n'); -} \ No newline at end of file +} diff --git a/src/client/funcs/msToTime.js b/src/client/funcs/msToTime.js index 24574ca..07fdb9a 100644 --- a/src/client/funcs/msToTime.js +++ b/src/client/funcs/msToTime.js @@ -9,4 +9,4 @@ module.exports = function msToTime(duration) { : +hours > 0 ? `${+hours < 10 ? `0${hours}` : hours}:${+minutes < 10 ? `0${minutes}` : minutes}:${+seconds < 10 ? `0${seconds}` : seconds}` : `${+minutes < 10 ? `0${minutes}` : minutes}:${+seconds < 10 ? `0${seconds}` : seconds}`; -} \ No newline at end of file +} diff --git a/src/client/funcs/play.js b/src/client/funcs/play.js index fe81608..464e242 100644 --- a/src/client/funcs/play.js +++ b/src/client/funcs/play.js @@ -47,7 +47,7 @@ module.exports = async function play(interaction, guild, client, url) { .addField(client.messages.nowplayingTitle, message.nowplayingDescription, true) .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); - + const buttons = new Discord.MessageActionRow() .addComponents( new Discord.MessageButton() @@ -87,10 +87,10 @@ module.exports = async function play(interaction, guild, client, url) { } message.play = client.messages.play.replace("%radio.station.name%", radio.station.name); - + interaction?.reply({ content: client.messageEmojis["play"] + message.play, ephemeral: true }); - -} \ No newline at end of file + +} diff --git a/src/client/funcs/restoreRadios.js b/src/client/funcs/restoreRadios.js index c1a4a39..10aff24 100644 --- a/src/client/funcs/restoreRadios.js +++ b/src/client/funcs/restoreRadios.js @@ -43,7 +43,7 @@ module.exports = async function restoreRadios(client, guilds) { construct.connection = connection; let date = new Date(); construct.startTime = date.getTime(); - + client.funcs.play(null, guild, client, url, Discord); client.datastore.checkEntry(guild.id); @@ -59,4 +59,4 @@ module.exports = async function restoreRadios(client, guilds) { console.log(error); } }); -} \ No newline at end of file +} diff --git a/src/client/funcs/saveRadios.js b/src/client/funcs/saveRadios.js index 30280e1..9e7b187 100644 --- a/src/client/funcs/saveRadios.js +++ b/src/client/funcs/saveRadios.js @@ -1,11 +1,11 @@ module.exports = function saveRadios(client) { let currentRadios = client.radio.keys(); let radio = currentRadios.next(); - + while (!radio.done) { let currentRadio = client.radio.get(radio.value); currentRadio.guild = client.datastore.getEntry(radio.value).guild; - + if (currentRadio) { client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio); client.funcs.saveState(client, currentRadio.guild, currentRadio); @@ -14,7 +14,7 @@ module.exports = function saveRadios(client) { currentRadio.message?.delete(); client.radio.delete(radio.value); } - + radio = currentRadios.next(); } -} \ No newline at end of file +} diff --git a/src/client/funcs/saveState.js b/src/client/funcs/saveState.js index eb59553..6ef476a 100644 --- a/src/client/funcs/saveState.js +++ b/src/client/funcs/saveState.js @@ -1,6 +1,6 @@ module.exports = function saveState(client, guild, radio){ client.datastore.checkEntry(guild.id); - + let date = new Date(); let data = client.datastore.getEntry(guild.id); @@ -15,4 +15,4 @@ module.exports = function saveState(client, guild, radio){ data.state.station.owner = radio.station.owner; client.datastore.updateEntry(guild, data); -} \ No newline at end of file +} diff --git a/src/client/funcs/searchStation.js b/src/client/funcs/searchStation.js index f443fd0..9206722 100644 --- a/src/client/funcs/searchStation.js +++ b/src/client/funcs/searchStation.js @@ -59,4 +59,4 @@ module.exports = function searchStation(key, client) { } } return highestProbabilityStation; -} \ No newline at end of file +} diff --git a/src/client/funcs/statisticsUpdate.js b/src/client/funcs/statisticsUpdate.js index 4fcf09c..fcd3ad1 100644 --- a/src/client/funcs/statisticsUpdate.js +++ b/src/client/funcs/statisticsUpdate.js @@ -1,22 +1,22 @@ module.exports = function statisticsUpdate(client, guild, radio) { - + client.datastore.checkEntry(guild.id); - + radio.datastore = client.datastore.getEntry(guild.id); - + if(!radio.datastore.statistics[radio.station.name]){ radio.datastore.statistics[radio.station.name] = {}; radio.datastore.statistics[radio.station.name].time = 0; radio.datastore.statistics[radio.station.name].used = 0; client.datastore.updateEntry(guild, radio.datastore); } - + let date = new Date(); radio.currentTime = date.getTime(); radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime); radio.datastore.statistics[radio.station.name].time = parseInt(radio.datastore.statistics[radio.station.name].time)+parseInt(radio.playTime); - + radio.datastore.statistics[radio.station.name].used = parseInt(radio.datastore.statistics[radio.station.name].used)+1; client.datastore.updateEntry(guild, radio.datastore); client.datastore.calculateGlobal(client); -} \ No newline at end of file +} diff --git a/src/client/messages.js b/src/client/messages.js index c0b01af..2719663 100644 --- a/src/client/messages.js +++ b/src/client/messages.js @@ -37,4 +37,4 @@ module.exports = { errorStationURL: "Station can't be URL", messageCommandsDeprecatedTitle: "%client.user.username%", messageCommandsDeprecatedDescription: "We recommend you to reauthorize our bot by clicking the invite link down below, because Discord is planning to remove message content from verified bots [Read More](https://support-dev.discord.com/hc/en-us/articles/4404772028055)" + "\n\n" + "**Invite Bot**" + "\n" + "https://wgi.fi/radiox_invite" + "\n\n" + "This bot now supports slash commands, you should start using them instead. Type / into the message box and select the bot you wish to use. Remember to be careful as there are a few bugs here and there on Discord." + "\n\n" + "We will remove this deprecation message in March of 2022 when RadioX 1.0.0 is released." -}; \ No newline at end of file +}; diff --git a/src/client/utils/typings.ts b/src/client/utils/typings.ts index 79cc341..1e5d860 100644 --- a/src/client/utils/typings.ts +++ b/src/client/utils/typings.ts @@ -1,3 +1,3 @@ export interface command { } -export interface radio {} \ No newline at end of file +export interface radio {} diff --git a/src/config.js b/src/config.js index 2aa884d..c306e50 100644 --- a/src/config.js +++ b/src/config.js @@ -23,4 +23,4 @@ module.exports = { version: process.env.RADIOX_VERSION || process.env.npm_package_version, debug: process.env.DEBUG_MODE || false -} \ No newline at end of file +} From 65bebb7b13f9ca0a4bf9bf287231f115d8dd51a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 12:56:34 +0300 Subject: [PATCH 19/40] Bumb version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6dc8e6e..c1627ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "eximiabots-radiox", - "version": "0.3.10", + "version": "0.3.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "eximiabots-radiox", - "version": "0.3.10", + "version": "0.3.8", "license": "MIT", "dependencies": { "@discordjs/builders": "^0.6.0", diff --git a/package.json b/package.json index dade298..283b9d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eximiabots-radiox", - "version": "0.3.10", + "version": "0.3.8", "description": "Internet Radio to your Discord guild", "main": "index.js", "scripts": { From 8399fd5bb1260e671968f002d9d1f4765d26ee76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 17:56:51 +0300 Subject: [PATCH 20/40] Added security policy in SECURITY.md --- SECURITY.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..4adaa6f --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,17 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| 0.3.x | :white_check_mark: | +| 0.2.x | :x: | +| 0.1.x | :x: | + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. From 93b5663ebecbd6c0bdb5d1d5c67ed99d9669e328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 17:57:15 +0300 Subject: [PATCH 21/40] Added SECURITY.md to be labeled with documentation in labeler config --- .github/labeler.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index 43d4f25..558d0c5 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -3,5 +3,6 @@ dependencies: documentation: - README.md +- SECURITY.md - LICENSE - .env_example From 17a075cd29e26f005b33165559b112fbeb3cb3fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:51:25 +0300 Subject: [PATCH 22/40] Add CONTRIBUTING.md --- CONTRIBUTING.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..f6a5366 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# Contributing + +:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: + +If you haven't already, come find us in [Discord](https://waren.io/r/eximiabots-discord). We want you working on things you're excited about. + +Here are some important resources: + + * [Discord](https://waren.io/r/eximiabots-discord) Join our Discord guild. + +## Coding + +### Pull Requests + * Open a new PR from your fork's new branch into develop branch. + * Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. + * Try to fix all merge conflicts. + +### Coding conventions + * We indent using four spaces (soft tabs) + * We ALWAYS put spaces after list items and method parameters (`[1, 2, 3]`, not `[1,2,3]`), around operators (`x += 1`, not `x+=1`), and around hash arrows. + * This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible. + +## Testing + +We have currently automated testing in Github Workflows, you can suggest new Github Workflows to us by making PR. + +Every release is manually tested by [cwchristerw](https://github.com/cwchristerw) or [MatteZ02](https://github.com/MatteZ02). From fb257d1c304f49f6283d7564a676f7476cb70593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:51:42 +0300 Subject: [PATCH 23/40] Add CONTRIBUTING.md to labeler config --- .github/labeler.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index 558d0c5..969a66b 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -4,5 +4,6 @@ dependencies: documentation: - README.md - SECURITY.md +- CONTRIBUTING.md - LICENSE - .env_example From 9e2be295c3eaab16f02c324f151e6231ae1c94a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:52:25 +0300 Subject: [PATCH 24/40] Update stop command --- src/client/commands/stop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/commands/stop.js b/src/client/commands/stop.js index d457c99..dd6174f 100644 --- a/src/client/commands/stop.js +++ b/src/client/commands/stop.js @@ -5,8 +5,8 @@ module.exports = { description: 'Stop radio', category: 'radio', async execute(interaction, client, command) { - const radio = client.radio.get(interaction.guild.id); if (client.funcs.check(client, interaction, command)) { + const radio = client.radio.get(interaction.guild.id); client.funcs.statisticsUpdate(client, interaction.guild, radio); radio.connection?.destroy(); radio.audioPlayer?.stop(); From 3807ae89a0061467ad75ab5270cb719ae6b756d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:52:50 +0300 Subject: [PATCH 25/40] Add maintenance message in messages.js --- src/client/messages.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/messages.js b/src/client/messages.js index 2719663..f893ff8 100644 --- a/src/client/messages.js +++ b/src/client/messages.js @@ -36,5 +36,6 @@ module.exports = { statusField5: "Hosted by", errorStationURL: "Station can't be URL", messageCommandsDeprecatedTitle: "%client.user.username%", - messageCommandsDeprecatedDescription: "We recommend you to reauthorize our bot by clicking the invite link down below, because Discord is planning to remove message content from verified bots [Read More](https://support-dev.discord.com/hc/en-us/articles/4404772028055)" + "\n\n" + "**Invite Bot**" + "\n" + "https://wgi.fi/radiox_invite" + "\n\n" + "This bot now supports slash commands, you should start using them instead. Type / into the message box and select the bot you wish to use. Remember to be careful as there are a few bugs here and there on Discord." + "\n\n" + "We will remove this deprecation message in March of 2022 when RadioX 1.0.0 is released." + messageCommandsDeprecatedDescription: "We recommend you to reauthorize our bot by clicking the invite link down below, because Discord is planning to remove message content from verified bots [Read More](https://support-dev.discord.com/hc/en-us/articles/4404772028055)" + "\n\n" + "**Invite Bot**" + "\n" + "https://wgi.fi/radiox_invite" + "\n\n" + "This bot now supports slash commands, you should start using them instead. Type / into the message box and select the bot you wish to use. Remember to be careful as there are a few bugs here and there on Discord." + "\n\n" + "We will remove this deprecation message in March of 2022 when RadioX 1.0.0 is released.", + maintenance: "Shhhh... We are now sleeping and dreaming about new features to implement. Will be back soon." }; From 9c3748ad7c85cbe1ec4b2abbf23bcd53f246ebfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:53:24 +0300 Subject: [PATCH 26/40] Add maintenance mode to check function --- src/client/funcs/check.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/client/funcs/check.js b/src/client/funcs/check.js index cfbbbc5..e164cbb 100644 --- a/src/client/funcs/check.js +++ b/src/client/funcs/check.js @@ -2,6 +2,13 @@ module.exports = function (client, interaction, command) { let message = {}; const radio = client.radio.get(interaction.guild.id); const permissions = interaction.channel.permissionsFor(interaction.user); + if(client.config.maintenance){ + interaction.reply({ + content: client.messageEmojis["error"] + client.messages.maintenance, + ephemeral: true + }); + return false; + } if(!client.stations) { message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); interaction.reply({ From 22c0544d0948e75df8cc719b051a77a0a2f464e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:53:46 +0300 Subject: [PATCH 27/40] Add maintenance mode check in play command --- src/client/commands/play.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/client/commands/play.js b/src/client/commands/play.js index 661a081..cdbd6b4 100644 --- a/src/client/commands/play.js +++ b/src/client/commands/play.js @@ -14,6 +14,15 @@ module.exports = { category: "radio", async execute(interaction, client) { let message = {}; + + if(client.config.maintenance){ + interaction.reply({ + content: client.messageEmojis["error"] + client.messages.maintenance, + ephemeral: true + }); + return false; + } + if(!client.stations) { message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); return interaction.reply({ From 526bb7736a0de8d93f838df422dc1b0e349f9361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:54:23 +0300 Subject: [PATCH 28/40] Update list command --- src/client/commands/list.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/commands/list.js b/src/client/commands/list.js index 47edaee..59772f0 100644 --- a/src/client/commands/list.js +++ b/src/client/commands/list.js @@ -6,6 +6,7 @@ module.exports = { category: 'radio', execute(interaction, client) { let message = {}; + if(!client.stations) { message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); return interaction.reply({ @@ -16,7 +17,7 @@ module.exports = { const radio = client.radio.get(interaction.guild.id); - if(radio){ + if(radio && !client.config.maintenance){ client.funcs.listStations(client, interaction); } else { let stations = `${client.stations.map(s => `**#** ${s.name}`).join('\n')}` From 5c1a8f0ef16afd9287e3d484d8ce141aceba75f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:54:51 +0300 Subject: [PATCH 29/40] Add maintenance mode in config.js --- src/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.js b/src/config.js index c306e50..b161603 100644 --- a/src/config.js +++ b/src/config.js @@ -21,6 +21,6 @@ module.exports = { //Settings version: process.env.RADIOX_VERSION || process.env.npm_package_version, - debug: process.env.DEBUG_MODE || false - + debug: process.env.DEBUG_MODE || false, + maintenance: false } From 44a708548f1e71223a3ee9a17489bf72d103c56b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:55:18 +0300 Subject: [PATCH 30/40] Update maintenance command --- src/client/commands/maintenance.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/commands/maintenance.js b/src/client/commands/maintenance.js index 89e01d2..8f7745e 100644 --- a/src/client/commands/maintenance.js +++ b/src/client/commands/maintenance.js @@ -125,9 +125,13 @@ module.exports = { break; case "8": client.user.setStatus('dnd'); + client.funcs.logger("Maintenance Mode", "Enabled"); + client.config.maintenance = false; break; case "9": client.user.setStatus('online'); + client.funcs.logger("Maintenance Mode", "Disabled"); + client.config.maintenance = false; break; default: From 3b5c24187211320ea22ed6ac93d571b62894d814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:55:33 +0300 Subject: [PATCH 31/40] Update ready.js --- src/client/events/ready.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/client/events/ready.js b/src/client/events/ready.js index 31e9de2..ccc6a66 100644 --- a/src/client/events/ready.js +++ b/src/client/events/ready.js @@ -99,5 +99,11 @@ module.exports = { client.funcs.restoreRadios(client, guilds); }, 5000); + setTimeout(function () { + /*MAINTENANCE MODE*/ + client.funcs.logger("Maintenance Mode", "Disabled"); + client.config.maintenance = false; + }, 10000); + } } From 24071eb5dfa2d5ead23e55740f72265cd3328bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 9 Sep 2021 18:55:42 +0300 Subject: [PATCH 32/40] Update Client.ts --- src/Client.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Client.ts b/src/Client.ts index 3bfdcc3..2e0d282 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -52,6 +52,9 @@ class RadioClient extends Client { this.funcs.logger("Bot", "Starting"); + this.funcs.logger("Maintenance Mode", "Enabled"); + this.config.maintenance = true; + const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter(f => f.endsWith(".js")); for (const file of commandFiles) { const command = require(`./client/commands/${file}`); From 8c9fe03629b061258c0624155c05584633d0f3b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 10 Sep 2021 00:24:30 +0300 Subject: [PATCH 33/40] Updated Dependencies --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0e61d54..b3d384d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -500,9 +500,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.9.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.0.tgz", - "integrity": "sha512-nmP+VR4oT0pJUPFbKE4SXj3Yb4Q/kz3M9dSAO1GGMebRKWHQxLfDNmU/yh3xxCJha3N60nQ/JwXWwOE/ZSEVag==" + "version": "16.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", + "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==" }, "node_modules/@types/ws": { "version": "7.4.7", @@ -4369,9 +4369,9 @@ "dev": true }, "@types/node": { - "version": "16.9.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.0.tgz", - "integrity": "sha512-nmP+VR4oT0pJUPFbKE4SXj3Yb4Q/kz3M9dSAO1GGMebRKWHQxLfDNmU/yh3xxCJha3N60nQ/JwXWwOE/ZSEVag==" + "version": "16.9.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", + "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==" }, "@types/ws": { "version": "7.4.7", From 200f16eac08ac3ec162ce47315fe88d7317bf421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 10 Sep 2021 01:21:14 +0300 Subject: [PATCH 34/40] Disable Node warnings in package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8a808d5..d394755 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "main": "index.js", "scripts": { "build": "rimraf ./build && tsc", - "start": "node build/index.js", - "start:dev": "npm run build && node build/index.js" + "start": "node --no-warnings build/index.js", + "start:dev": "npm run build && node --no-warnings build/index.js" }, "repository": { "type": "git", From 44d81b6fd775a7cdc616afd185856d38ff6eb7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 10 Sep 2021 01:21:42 +0300 Subject: [PATCH 35/40] Add warning event --- src/Client.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Client.ts b/src/Client.ts index 2e0d282..8a89e5f 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -81,6 +81,10 @@ class RadioClient extends Client { require(`${events}voiceStateUpdate`).execute(this, oldState, newState); }); + this.on("error", error => { + console.error(error); + }); + process.on('SIGINT', () => { require(`${events}SIGINT`).execute(this); }); @@ -97,8 +101,14 @@ class RadioClient extends Client { this.funcs.logger("Bot", "Stopping"); }); - this.on("error", error => { - console.error(error); + process.on('warning', (warning) => { + if(warning.name == "ExperimentalWarning" && warning.message.startsWith("stream/web")) return; + + this.funcs.logger("Warning"); + console.warn(warning.name); + console.warn(warning.message); + console.warn(warning.stack); + console.log(''); }); this.login(this.config.token).catch(err => console.log("Failed to login: " + err)); From 6541287decbd0b43b2884f3097988206cd5c4bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 10 Sep 2021 01:43:21 +0300 Subject: [PATCH 36/40] Update uncaughtException event --- src/client/events/uncaughtException.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/events/uncaughtException.js b/src/client/events/uncaughtException.js index ba3d8ac..cf73d98 100644 --- a/src/client/events/uncaughtException.js +++ b/src/client/events/uncaughtException.js @@ -1,7 +1,10 @@ module.exports = { name: 'uncaughtException', execute(client, error) { + this.funcs.logger("Error"); console.log(error.stack); + console.log(''); + process.emit('SIGINT'); } } From fee833d231edb9c8bf1a00ddfdd1b5f468845e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 10 Sep 2021 01:43:53 +0300 Subject: [PATCH 37/40] Update warning event --- src/client/events/warning.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/client/events/warning.js diff --git a/src/client/events/warning.js b/src/client/events/warning.js new file mode 100644 index 0000000..537c089 --- /dev/null +++ b/src/client/events/warning.js @@ -0,0 +1,12 @@ +module.exports = { + name: 'warning', + execute(client, warning) { + if(warning.name == "ExperimentalWarning" && warning.message.startsWith("stream/web")) return; + + client.funcs.logger("Warning"); + console.warn(warning.name); + console.warn(warning.message); + console.warn(warning.stack); + console.log(''); + } +} From 26cdef50b2fcbd63d0fe6bb3294503965d05201d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 10 Sep 2021 01:44:21 +0300 Subject: [PATCH 38/40] Update Client.ts --- src/Client.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Client.ts b/src/Client.ts index 8a89e5f..4adad51 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -82,7 +82,9 @@ class RadioClient extends Client { }); this.on("error", error => { + this.funcs.logger("Discord Client / Error"); console.error(error); + console.log(''); }); process.on('SIGINT', () => { @@ -102,13 +104,7 @@ class RadioClient extends Client { }); process.on('warning', (warning) => { - if(warning.name == "ExperimentalWarning" && warning.message.startsWith("stream/web")) return; - - this.funcs.logger("Warning"); - console.warn(warning.name); - console.warn(warning.message); - console.warn(warning.stack); - console.log(''); + require(`${events}warning`).execute(this, warning); }); this.login(this.config.token).catch(err => console.log("Failed to login: " + err)); From 3978f19b2e3327d300437549f6408ece7eb3e47d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 10 Sep 2021 01:54:30 +0300 Subject: [PATCH 39/40] Fix typo in uncaughtException event --- src/client/events/uncaughtException.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/events/uncaughtException.js b/src/client/events/uncaughtException.js index cf73d98..b81609d 100644 --- a/src/client/events/uncaughtException.js +++ b/src/client/events/uncaughtException.js @@ -1,7 +1,7 @@ module.exports = { name: 'uncaughtException', execute(client, error) { - this.funcs.logger("Error"); + client.funcs.logger("Error"); console.log(error.stack); console.log(''); From 1d6361871c3a3c6c088f027f4083640e365cc761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 10 Sep 2021 01:54:43 +0300 Subject: [PATCH 40/40] Update Client.ts --- src/Client.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Client.ts b/src/Client.ts index 4adad51..70e0095 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -107,7 +107,11 @@ class RadioClient extends Client { require(`${events}warning`).execute(this, warning); }); - this.login(this.config.token).catch(err => console.log("Failed to login: " + err)); + this.login(this.config.token).catch((err) => { + this.funcs.logger("Discord Client / Error"); + console.log(err); + console.log(''); + }); } }