From 1ca24d6e5335122b604dc0961dbb936ca141f0a7 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Mon, 10 Nov 2025 14:33:22 +0100 Subject: [PATCH 01/23] updated packages --- package-lock.json | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index c995ab14..75d2e4de 100755 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "discordbot", - "version": "4.0.1", + "version": "4.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "discordbot", - "version": "4.0.1", + "version": "4.1.1", "license": "AGPL-3.0-only", "dependencies": { "ajv": "^8.17.1", @@ -1176,9 +1176,9 @@ } }, "node_modules/@types/node": { - "version": "24.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.1.tgz", - "integrity": "sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg==", + "version": "24.10.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.0.tgz", + "integrity": "sha512-qzQZRBqkFsYyaSWXuEHc2WR9c0a0CXwiE5FWUvn7ZM+vdy1uZLfCunD38UzhuB7YN/J11ndbDBcTmOdxJo9Q7A==", "license": "MIT", "dependencies": { "undici-types": "~7.16.0" @@ -1438,9 +1438,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.8.20", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.20.tgz", - "integrity": "sha512-JMWsdF+O8Orq3EMukbUN1QfbLK9mX2CkUmQBcW2T0s8OmdAUL5LLM/6wFwSrqXzlXB13yhyK9gTKS1rIizOduQ==", + "version": "2.8.25", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.25.tgz", + "integrity": "sha512-2NovHVesVF5TXefsGX1yzx1xgr7+m9JQenvz6FQY3qd+YXkKkYiv+vTCc7OriP9mcDZpTC5mAOYN4ocd29+erA==", "dev": true, "license": "Apache-2.0", "bin": { @@ -1550,9 +1550,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001751", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001751.tgz", - "integrity": "sha512-A0QJhug0Ly64Ii3eIqHu5X51ebln3k4yTUkY1j8drqpWHVreg/VLijN48cZ1bYPiqOQuqpkIKnzr/Ul8V+p6Cw==", + "version": "1.0.30001754", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001754.tgz", + "integrity": "sha512-x6OeBXueoAceOmotzx3PO4Zpt4rzpeIFsSr6AAePTZxSkXiYDUmpypEl7e2+8NCd9bD7bXjqyef8CJYPC1jfxg==", "dev": true, "funding": [ { @@ -1883,18 +1883,18 @@ } }, "node_modules/discord-api-types": { - "version": "0.38.31", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.31.tgz", - "integrity": "sha512-kC94ANsk8ackj8ENTuO8joTNEL0KtymVhHy9dyEC/s4QAZ7GCx40dYEzQaadyo8w+oP0X8QydE/nzAWRylTGtQ==", + "version": "0.38.33", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.33.tgz", + "integrity": "sha512-oau1V7OzrNX8yNi+DfQpoLZCNCv7cTFmvPKwHfMrA/tewsO6iQKrMTzA7pa3iBSj0fED6NlklJ/1B/cC1kI08Q==", "license": "MIT", "workspaces": [ "scripts/actions/documentation" ] }, "node_modules/discord.js": { - "version": "14.24.0", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.24.0.tgz", - "integrity": "sha512-KNq/ekT8bsmT3ZAfVre8cPbl+DfVYSdlLnDmGZPoz7Cw21LYeWHllRA9MivqNq5b1GPGAxGvyUN1vxbTb/PQWw==", + "version": "14.24.2", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.24.2.tgz", + "integrity": "sha512-VMEDbmguRdX/EeMaTsf9Mb0IQA90WdYF2cn4QDfslQFXgQ6LFtmlPn0FSotnS0kcFbFp+JBSIxtnF+bnAHG/hQ==", "license": "Apache-2.0", "dependencies": { "@discordjs/builders": "^1.13.0", @@ -1995,9 +1995,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.240", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.240.tgz", - "integrity": "sha512-OBwbZjWgrCOH+g6uJsA2/7Twpas2OlepS9uvByJjR2datRDuKGYeD+nP8lBBks2qnB7bGJNHDUx7c/YLaT3QMQ==", + "version": "1.5.249", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.249.tgz", + "integrity": "sha512-5vcfL3BBe++qZ5kuFhD/p8WOM1N9m3nwvJPULJx+4xf2usSlZFJ0qoNYO2fOX4hi3ocuDcmDobtA+5SFr4OmBg==", "dev": true, "license": "ISC" }, @@ -3476,9 +3476,9 @@ "license": "MIT" }, "node_modules/node-releases": { - "version": "2.0.26", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.26.tgz", - "integrity": "sha512-S2M9YimhSjBSvYnlr5/+umAnPHE++ODwt5e2Ij6FoX45HA/s4vHdkDx1eax2pAPeAOqu4s9b7ppahsyEFdVqQA==", + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", "dev": true, "license": "MIT" }, From 3ad40c3e2ceddd2f208f9697ceb000dfdea0c1a5 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Mon, 10 Nov 2025 19:33:02 +0100 Subject: [PATCH 02/23] created darwin-random command --- src/commands/fun/darwin-random.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/commands/fun/darwin-random.js diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js new file mode 100644 index 00000000..440467fa --- /dev/null +++ b/src/commands/fun/darwin-random.js @@ -0,0 +1,14 @@ +import { SlashCommandBuilder } from "discord.js"; +import { query } from "../../helpers/db.js"; + +export default { + data: new SlashCommandBuilder() + .setName("darwin-random") + .setDescription("Sends back a random streamable video from Darwin's database.") + .setNSFW(false) + .setDMPermission(true), + async execute(interaction) { + const randomVideo = query("SELECT * COUNT FROM darwinCache"); + console.log(randomVideo); + }, +}; From f81cb0f5a042ccd88714a401642235106dc240dc Mon Sep 17 00:00:00 2001 From: VB2007 Date: Tue, 11 Nov 2025 09:22:55 +0100 Subject: [PATCH 03/23] created base logic to reply helper --- src/commands/fun/darwin-random.js | 20 ++++++++++++++++++-- src/helpers/reply.js | 9 +++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index 440467fa..79327ef3 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -1,5 +1,7 @@ import { SlashCommandBuilder } from "discord.js"; import { query } from "../../helpers/db.js"; +import { embedReplyPrimaryColorWithFields } from "../../helpers/embeds/embed-reply.js"; +import { replyAndLogWithEmbedAndDescription } from "../../helpers/reply.js"; export default { data: new SlashCommandBuilder() @@ -8,7 +10,21 @@ export default { .setNSFW(false) .setDMPermission(true), async execute(interaction) { - const randomVideo = query("SELECT * COUNT FROM darwinCache"); - console.log(randomVideo); + const randomVideo = query( + "SELECT videoId, processedAt FROM darwinCache ORDER BY RAND() LIMIT 1;" + ); + + const embedReply = embedReplyPrimaryColorWithFields( + "Random video from Darwin's database", + "", + [ + { name: "Title", value: "", inline: false }, + { name: "Processed at", value: "", inline: true }, + { name: "Size", value: "", inline: true }, + ], + interaction + ); + + await replyAndLogWithEmbedAndDescription(interaction, embedReply, "a"); }, }; diff --git a/src/helpers/reply.js b/src/helpers/reply.js index d298ff8c..46e03cf8 100644 --- a/src/helpers/reply.js +++ b/src/helpers/reply.js @@ -4,3 +4,12 @@ export const replyAndLog = async (interaction, embedReply) => { await interaction.reply({ embeds: [embedReply] }); await logToFileAndDatabase(interaction, JSON.stringify(embedReply.toJSON())); }; + +export const replyAndLogWithEmbedAndDescription = async ( + interaction, + embedReply, + messageContent +) => { + await interaction.reply(messageContent, { embeds: [embedReply] }); + await logToFileAndDatabase(interaction, messageContent); +}; From 9f7060917ab7b0636adb85fe168a0f281b39cb1a Mon Sep 17 00:00:00 2001 From: VB2007 Date: Wed, 12 Nov 2025 18:54:39 +0100 Subject: [PATCH 04/23] updated cdn url in example config json --- config.json.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.json.example b/config.json.example index 73425cb6..575393b8 100644 --- a/config.json.example +++ b/config.json.example @@ -38,6 +38,6 @@ "maxDownloadSize" : 50, "targetDir" : "/path/to/videos/folder", "tempDir" : "/path/to/videos/folder/transcodes", - "cdnUrl" : "https://cdn.vb2007.hu/darwin/" + "cdnUrl" : "https://cdn.vb2007.hu/darwin" } } From 55d597f2e3563ced4cf14708f8cd67b3883aabc0 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Thu, 13 Nov 2025 17:59:41 +0100 Subject: [PATCH 05/23] updated reply helper, started formatting message --- src/commands/fun/darwin-random.js | 12 ++++++++++-- src/helpers/reply.js | 8 ++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index 79327ef3..71c618b6 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -1,7 +1,10 @@ import { SlashCommandBuilder } from "discord.js"; import { query } from "../../helpers/db.js"; import { embedReplyPrimaryColorWithFields } from "../../helpers/embeds/embed-reply.js"; -import { replyAndLogWithEmbedAndDescription } from "../../helpers/reply.js"; +import { baseReplyAndLog } from "../../helpers/reply.js"; + +import config from "../../../config.json" with { type: "json" }; +const darwinConfig = config.darwin; export default { data: new SlashCommandBuilder() @@ -14,6 +17,11 @@ export default { "SELECT videoId, processedAt FROM darwinCache ORDER BY RAND() LIMIT 1;" ); + const videoId = randomVideo[0].videoId; + const directStreamLink = `${darwinConfig.cdnUrl}/${videoId}.mp4`; + + const messageContent = `[[ STREAMING & DOWNLOAD ]](${directStreamLink}) - [[ FORUM POST ]](<${comments}>)\nTitle: {}\nProcessed at: {}\nSize: {}`; + const embedReply = embedReplyPrimaryColorWithFields( "Random video from Darwin's database", "", @@ -25,6 +33,6 @@ export default { interaction ); - await replyAndLogWithEmbedAndDescription(interaction, embedReply, "a"); + await baseReplyAndLog(messageContent, embedReply, "a"); }, }; diff --git a/src/helpers/reply.js b/src/helpers/reply.js index 46e03cf8..0b47be86 100644 --- a/src/helpers/reply.js +++ b/src/helpers/reply.js @@ -5,11 +5,7 @@ export const replyAndLog = async (interaction, embedReply) => { await logToFileAndDatabase(interaction, JSON.stringify(embedReply.toJSON())); }; -export const replyAndLogWithEmbedAndDescription = async ( - interaction, - embedReply, - messageContent -) => { - await interaction.reply(messageContent, { embeds: [embedReply] }); +export const baseReplyAndLog = async (interaction, message) => { + await interaction.reply(messageContent); await logToFileAndDatabase(interaction, messageContent); }; From d65820923adc64ed42fdbead665c3550b87398a2 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Thu, 13 Nov 2025 20:48:09 +0100 Subject: [PATCH 06/23] renamed, added columns to darwinCache table --- src/sql/darwinCache/table.sql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sql/darwinCache/table.sql b/src/sql/darwinCache/table.sql index 1f1a396d..d26ebd63 100644 --- a/src/sql/darwinCache/table.sql +++ b/src/sql/darwinCache/table.sql @@ -2,9 +2,13 @@ CREATE TABLE IF NOT EXISTS `darwinCache` ( `id` INT AUTO_INCREMENT PRIMARY KEY, - `videoUrl` VARCHAR(255) NOT NULL, + `originalFileUrl` VARCHAR(255) NOT NULL, + `forumPostUrl` VARCHAR(255) NOT NULL, `videoId` VARCHAR(100) NOT NULL, + `videoTitle` VARCHAR(180) NOT NULL, + `originalFileSize` DECIMAL NOT NULL, + `processedFileSize` DECIMAL DEFAULT NULL, `processedAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY (`videoUrl`), UNIQUE KEY (`videoId`) -); \ No newline at end of file +); From 3d1f08c26e0222f846ac72a7444d5076938de6c2 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Fri, 21 Nov 2025 02:48:53 +0100 Subject: [PATCH 07/23] fixed merge conflict in package-lock --- package-lock.json | 42 +++--------------------------------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8455b2e6..34fa74b7 100755 --- a/package-lock.json +++ b/package-lock.json @@ -1179,15 +1179,9 @@ } }, "node_modules/@types/node": { -<<<<<<< HEAD - "version": "24.10.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.0.tgz", - "integrity": "sha512-qzQZRBqkFsYyaSWXuEHc2WR9c0a0CXwiE5FWUvn7ZM+vdy1uZLfCunD38UzhuB7YN/J11ndbDBcTmOdxJo9Q7A==", -======= "version": "24.10.1", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", ->>>>>>> dev "license": "MIT", "dependencies": { "undici-types": "~7.16.0" @@ -1447,15 +1441,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { -<<<<<<< HEAD - "version": "2.8.25", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.25.tgz", - "integrity": "sha512-2NovHVesVF5TXefsGX1yzx1xgr7+m9JQenvz6FQY3qd+YXkKkYiv+vTCc7OriP9mcDZpTC5mAOYN4ocd29+erA==", -======= "version": "2.8.30", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.30.tgz", "integrity": "sha512-aTUKW4ptQhS64+v2d6IkPzymEzzhw+G0bA1g3uBRV3+ntkH+svttKseW5IOR4Ed6NUVKqnY7qT3dKvzQ7io4AA==", ->>>>>>> dev "dev": true, "license": "Apache-2.0", "bin": { @@ -1565,15 +1553,9 @@ } }, "node_modules/caniuse-lite": { -<<<<<<< HEAD - "version": "1.0.30001754", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001754.tgz", - "integrity": "sha512-x6OeBXueoAceOmotzx3PO4Zpt4rzpeIFsSr6AAePTZxSkXiYDUmpypEl7e2+8NCd9bD7bXjqyef8CJYPC1jfxg==", -======= "version": "1.0.30001756", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001756.tgz", "integrity": "sha512-4HnCNKbMLkLdhJz3TToeVWHSnfJvPaq6vu/eRP0Ahub/07n484XHhBF5AJoSGHdVrS8tKFauUQz8Bp9P7LVx7A==", ->>>>>>> dev "dev": true, "funding": [ { @@ -1904,30 +1886,18 @@ } }, "node_modules/discord-api-types": { -<<<<<<< HEAD - "version": "0.38.33", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.33.tgz", - "integrity": "sha512-oau1V7OzrNX8yNi+DfQpoLZCNCv7cTFmvPKwHfMrA/tewsO6iQKrMTzA7pa3iBSj0fED6NlklJ/1B/cC1kI08Q==", -======= "version": "0.38.34", "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.34.tgz", "integrity": "sha512-muq7xKGznj5MSFCzuIm/2TO7DpttuomUTemVM82fRqgnMl70YRzEyY24jlbiV6R9tzOTq6A6UnZ0bsfZeKD38Q==", ->>>>>>> dev "license": "MIT", "workspaces": [ "scripts/actions/documentation" ] }, "node_modules/discord.js": { -<<<<<<< HEAD - "version": "14.24.2", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.24.2.tgz", - "integrity": "sha512-VMEDbmguRdX/EeMaTsf9Mb0IQA90WdYF2cn4QDfslQFXgQ6LFtmlPn0FSotnS0kcFbFp+JBSIxtnF+bnAHG/hQ==", -======= "version": "14.25.0", "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.25.0.tgz", "integrity": "sha512-9rnJWTAkfauKTieYJ3oI4oncrSzpbJPWN1/XU+2H6wsHQPtqbOrXvgM0nFhSVnIbTo7nfUF7fzcYRevvRGjpzA==", ->>>>>>> dev "license": "Apache-2.0", "dependencies": { "@discordjs/builders": "^1.13.0", @@ -2028,15 +1998,9 @@ } }, "node_modules/electron-to-chromium": { -<<<<<<< HEAD - "version": "1.5.249", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.249.tgz", - "integrity": "sha512-5vcfL3BBe++qZ5kuFhD/p8WOM1N9m3nwvJPULJx+4xf2usSlZFJ0qoNYO2fOX4hi3ocuDcmDobtA+5SFr4OmBg==", -======= - "version": "1.5.258", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.258.tgz", - "integrity": "sha512-rHUggNV5jKQ0sSdWwlaRDkFc3/rRJIVnOSe9yR4zrR07m3ZxhP4N27Hlg8VeJGGYgFTxK5NqDmWI4DSH72vIJg==", ->>>>>>> dev + "version": "1.5.259", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.259.tgz", + "integrity": "sha512-I+oLXgpEJzD6Cwuwt1gYjxsDmu/S/Kd41mmLA3O+/uH2pFRO/DvOjUyGozL8j3KeLV6WyZ7ssPwELMsXCcsJAQ==", "dev": true, "license": "ISC" }, From 453bc33b6948679ca33444407f58e29c175132e0 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Fri, 21 Nov 2025 03:12:45 +0100 Subject: [PATCH 08/23] fixed query in /darwin-random --- src/commands/fun/darwin-random.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index 71c618b6..6524e981 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -14,7 +14,12 @@ export default { .setDMPermission(true), async execute(interaction) { const randomVideo = query( - "SELECT videoId, processedAt FROM darwinCache ORDER BY RAND() LIMIT 1;" + `SELECT originalFileUrl, forumPostUrl, title, processedAt + FROM darwinCache + WHERE forumPostUrl IS NOT NULL + AND title IS NOT NULL + ORDER BY RANDOM() + LIMIT 1` ); const videoId = randomVideo[0].videoId; From 98c43140f5214cf05251a13ad600a531d6c54ac4 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Fri, 21 Nov 2025 03:19:20 +0100 Subject: [PATCH 09/23] updated message format & query --- src/commands/fun/darwin-random.js | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index 6524e981..cbaee770 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -14,30 +14,23 @@ export default { .setDMPermission(true), async execute(interaction) { const randomVideo = query( - `SELECT originalFileUrl, forumPostUrl, title, processedAt + `SELECT directVideoUrl, forumPostUrl, videoTitle, processedAt FROM darwinCache WHERE forumPostUrl IS NOT NULL - AND title IS NOT NULL - ORDER BY RANDOM() + AND videoTitle IS NOT NULL + ORDER BY RAND() LIMIT 1` ); - const videoId = randomVideo[0].videoId; - const directStreamLink = `${darwinConfig.cdnUrl}/${videoId}.mp4`; + const directVideoUrl = randomVideo[0].directVideoUrl; + const forumPostUrl = randomVideo[0].forumPostUrl; + const videoTitle = randomVideo[0].videoTitle; + const processedAt = randomVideo[0].processedAt; - const messageContent = `[[ STREAMING & DOWNLOAD ]](${directStreamLink}) - [[ FORUM POST ]](<${comments}>)\nTitle: {}\nProcessed at: {}\nSize: {}`; + const messageContent = `[[ STREAMING & DOWNLOAD ]](${directVideoUrl}) - [[ FORUM POST ]](<${forumPostUrl}>)\n + Title: ${videoTitle} + \nProcessed at: ${processedAt}`; - const embedReply = embedReplyPrimaryColorWithFields( - "Random video from Darwin's database", - "", - [ - { name: "Title", value: "", inline: false }, - { name: "Processed at", value: "", inline: true }, - { name: "Size", value: "", inline: true }, - ], - interaction - ); - - await baseReplyAndLog(messageContent, embedReply, "a"); + await baseReplyAndLog(messageContent, messageContent); }, }; From cc9009e068ce9275e37cf5974d61d2ca136c14a7 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Fri, 21 Nov 2025 03:19:30 +0100 Subject: [PATCH 10/23] updated column name in sql file --- src/sql/darwinCache/table.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/darwinCache/table.sql b/src/sql/darwinCache/table.sql index 45a23973..ed284b81 100644 --- a/src/sql/darwinCache/table.sql +++ b/src/sql/darwinCache/table.sql @@ -2,7 +2,7 @@ CREATE TABLE IF NOT EXISTS `darwinCache` ( `id` INT AUTO_INCREMENT PRIMARY KEY, - `originalFileUrl` VARCHAR(255) NOT NULL, + `directVideoUrl` VARCHAR(255) NOT NULL, `forumPostUrl` VARCHAR(255) NOT NULL, `videoId` VARCHAR(100) NOT NULL, `videoTitle` VARCHAR(180) NOT NULL, From 205dabce6b627d3c8baae598dea96024ecf4064a Mon Sep 17 00:00:00 2001 From: VB2007 Date: Fri, 21 Nov 2025 03:24:30 +0100 Subject: [PATCH 11/23] fixed var name in reply helper, updated messageContent formatting --- src/commands/fun/darwin-random.js | 13 ++++++++----- src/helpers/reply.js | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index cbaee770..8e4409f5 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -13,7 +13,7 @@ export default { .setNSFW(false) .setDMPermission(true), async execute(interaction) { - const randomVideo = query( + const randomVideo = await query( `SELECT directVideoUrl, forumPostUrl, videoTitle, processedAt FROM darwinCache WHERE forumPostUrl IS NOT NULL @@ -22,15 +22,18 @@ export default { LIMIT 1` ); + console.log(randomVideo); + const directVideoUrl = randomVideo[0].directVideoUrl; const forumPostUrl = randomVideo[0].forumPostUrl; const videoTitle = randomVideo[0].videoTitle; const processedAt = randomVideo[0].processedAt; - const messageContent = `[[ STREAMING & DOWNLOAD ]](${directVideoUrl}) - [[ FORUM POST ]](<${forumPostUrl}>)\n - Title: ${videoTitle} - \nProcessed at: ${processedAt}`; + const messageContent = + `[[ STREAMING & DOWNLOAD ]](${directVideoUrl}) - [[ FORUM POST ]](<${forumPostUrl}>)\n` + + `**Title**: ${videoTitle}\n` + + `**Processed at**: ${processedAt}`; - await baseReplyAndLog(messageContent, messageContent); + await baseReplyAndLog(interaction, messageContent); }, }; diff --git a/src/helpers/reply.js b/src/helpers/reply.js index 0b47be86..f3324ba6 100644 --- a/src/helpers/reply.js +++ b/src/helpers/reply.js @@ -5,7 +5,7 @@ export const replyAndLog = async (interaction, embedReply) => { await logToFileAndDatabase(interaction, JSON.stringify(embedReply.toJSON())); }; -export const baseReplyAndLog = async (interaction, message) => { +export const baseReplyAndLog = async (interaction, messageContent) => { await interaction.reply(messageContent); await logToFileAndDatabase(interaction, messageContent); }; From 77b37e140a953ee894efcabfb14e430d76b37ff8 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Fri, 21 Nov 2025 03:28:05 +0100 Subject: [PATCH 12/23] updated processedAt time formatting --- src/commands/fun/darwin-random.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index 8e4409f5..167056a0 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -27,12 +27,12 @@ export default { const directVideoUrl = randomVideo[0].directVideoUrl; const forumPostUrl = randomVideo[0].forumPostUrl; const videoTitle = randomVideo[0].videoTitle; - const processedAt = randomVideo[0].processedAt; + const processedAt = Math.floor(new Date(randomVideo[0].processedAt).getTime() / 1000); const messageContent = `[[ STREAMING & DOWNLOAD ]](${directVideoUrl}) - [[ FORUM POST ]](<${forumPostUrl}>)\n` + `**Title**: ${videoTitle}\n` + - `**Processed at**: ${processedAt}`; + `**Processed at**: `; await baseReplyAndLog(interaction, messageContent); }, From fa17c8d146382d8a437e6e8d7d90a27d8024ab21 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Fri, 21 Nov 2025 03:29:29 +0100 Subject: [PATCH 13/23] changed processedAt formatting to relative time --- src/commands/fun/darwin-random.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index 167056a0..51eaeefe 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -32,7 +32,7 @@ export default { const messageContent = `[[ STREAMING & DOWNLOAD ]](${directVideoUrl}) - [[ FORUM POST ]](<${forumPostUrl}>)\n` + `**Title**: ${videoTitle}\n` + - `**Processed at**: `; + `**Processed at**: `; await baseReplyAndLog(interaction, messageContent); }, From 1c5c042fc34721af0bb9ea436222cfe0a4920795 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 22 Nov 2025 21:51:33 +0100 Subject: [PATCH 14/23] removed unused imports --- src/commands/fun/darwin-random.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index 51eaeefe..d7b41b6d 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -1,11 +1,7 @@ import { SlashCommandBuilder } from "discord.js"; import { query } from "../../helpers/db.js"; -import { embedReplyPrimaryColorWithFields } from "../../helpers/embeds/embed-reply.js"; import { baseReplyAndLog } from "../../helpers/reply.js"; -import config from "../../../config.json" with { type: "json" }; -const darwinConfig = config.darwin; - export default { data: new SlashCommandBuilder() .setName("darwin-random") From 22dc9046354fa4ff134007d04c4fa379ccd58111 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 22 Nov 2025 21:51:41 +0100 Subject: [PATCH 15/23] removed debug logging --- src/commands/fun/darwin-random.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index d7b41b6d..135a0d43 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -18,8 +18,6 @@ export default { LIMIT 1` ); - console.log(randomVideo); - const directVideoUrl = randomVideo[0].directVideoUrl; const forumPostUrl = randomVideo[0].forumPostUrl; const videoTitle = randomVideo[0].videoTitle; From df3dbbdba489c7cc72c62ec9ae8c9340a55928d9 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 22 Nov 2025 21:51:55 +0100 Subject: [PATCH 16/23] updated packages --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 34fa74b7..3cf82b2c 100755 --- a/package-lock.json +++ b/package-lock.json @@ -1895,9 +1895,9 @@ ] }, "node_modules/discord.js": { - "version": "14.25.0", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.25.0.tgz", - "integrity": "sha512-9rnJWTAkfauKTieYJ3oI4oncrSzpbJPWN1/XU+2H6wsHQPtqbOrXvgM0nFhSVnIbTo7nfUF7fzcYRevvRGjpzA==", + "version": "14.25.1", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.25.1.tgz", + "integrity": "sha512-2l0gsPOLPs5t6GFZfQZKnL1OJNYFcuC/ETWsW4VtKVD/tg4ICa9x+jb9bkPffkMdRpRpuUaO/fKkHCBeiCKh8g==", "license": "Apache-2.0", "dependencies": { "@discordjs/builders": "^1.13.0", From 97127ae931c0b9c9d274bd885a8e9c24e31110bc Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 22 Nov 2025 21:56:19 +0100 Subject: [PATCH 17/23] made title bold in darwinProcess --- src/helpers/darwin/darwinProcess.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/darwin/darwinProcess.js b/src/helpers/darwin/darwinProcess.js index 977b2167..c517655d 100644 --- a/src/helpers/darwin/darwinProcess.js +++ b/src/helpers/darwin/darwinProcess.js @@ -77,7 +77,7 @@ const getVideoLocation = async (href, markerOne, markerTwo) => { * @returns {string} - Formatted message */ const messageGen = (title, href, comments) => { - return `[[ STREAMING & DOWNLOAD ]](${href}) - [[ FORUM POST ]](<${comments}>)\n${title}`; + return `[[ STREAMING & DOWNLOAD ]](${href}) - [[ FORUM POST ]](<${comments}>)\n**${title}**`; }; /** From a10adeae0f5d1a8bf954e11e0146e5a414dc686c Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 22 Nov 2025 21:57:48 +0100 Subject: [PATCH 18/23] fdiscord --- src/commands/fun/darwin-random.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index 135a0d43..8e0ac20f 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -6,7 +6,7 @@ export default { data: new SlashCommandBuilder() .setName("darwin-random") .setDescription("Sends back a random streamable video from Darwin's database.") - .setNSFW(false) + .setNSFW(false) //should be true, but fucking discord forces id checks to view NSFW channel. i won't comply. .setDMPermission(true), async execute(interaction) { const randomVideo = await query( From bceda5387bcf58f42418ce0929c0ec0374246cb3 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 22 Nov 2025 22:01:10 +0100 Subject: [PATCH 19/23] updated darwinCache table schema declaration from prod db DDL --- src/sql/darwinCache/table.sql | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/sql/darwinCache/table.sql b/src/sql/darwinCache/table.sql index ed284b81..86ec5e5e 100644 --- a/src/sql/darwinCache/table.sql +++ b/src/sql/darwinCache/table.sql @@ -1,14 +1,13 @@ -- discordbot.darwinCache definition -CREATE TABLE IF NOT EXISTS `darwinCache` ( - `id` INT AUTO_INCREMENT PRIMARY KEY, - `directVideoUrl` VARCHAR(255) NOT NULL, - `forumPostUrl` VARCHAR(255) NOT NULL, - `videoId` VARCHAR(100) NOT NULL, - `videoTitle` VARCHAR(180) NOT NULL, - `originalFileSize` DECIMAL NOT NULL, - `processedFileSize` DECIMAL DEFAULT NULL, - `processedAt` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UNIQUE KEY (`directVideoUrl`), - UNIQUE KEY (`videoId`) +CREATE TABLE `darwinCache` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `directVideoUrl` varchar(255) NOT NULL, + `forumPostUrl` varchar(255) NOT NULL DEFAULT '', + `videoId` varchar(100) NOT NULL, + `videoTitle` varchar(180) NOT NULL DEFAULT '', + `processedAt` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `videoId` (`videoId`), + UNIQUE KEY `directVideoUrl` (`directVideoUrl`) ); From 2f1b8d69a0522e5391f22300d2e5432da2aeb7d2 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 22 Nov 2025 22:02:36 +0100 Subject: [PATCH 20/23] removed unneded config values from example config.json file --- config.json.example | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/config.json.example b/config.json.example index 575393b8..d45f9190 100644 --- a/config.json.example +++ b/config.json.example @@ -34,10 +34,6 @@ "feedUrl" : "https://theync.com/most-recent/", "interval" : 120000, "markerOne" : "https://theync.com/media/video", - "markerTwo" : "https://theync.com", - "maxDownloadSize" : 50, - "targetDir" : "/path/to/videos/folder", - "tempDir" : "/path/to/videos/folder/transcodes", - "cdnUrl" : "https://cdn.vb2007.hu/darwin" + "markerTwo" : "https://theync.com" } } From 5c439369f4f1bc61b0adbc7ce72e57c9f3020063 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 22 Nov 2025 22:13:10 +0100 Subject: [PATCH 21/23] updated commandData + fixed auto increment --- src/commands/fun/darwin-random.js | 2 +- src/data/commandData.csv | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/commands/fun/darwin-random.js b/src/commands/fun/darwin-random.js index 8e0ac20f..285e3e19 100644 --- a/src/commands/fun/darwin-random.js +++ b/src/commands/fun/darwin-random.js @@ -5,7 +5,7 @@ import { baseReplyAndLog } from "../../helpers/reply.js"; export default { data: new SlashCommandBuilder() .setName("darwin-random") - .setDescription("Sends back a random streamable video from Darwin's database.") + .setDescription("Sends back a random, streamable video from Darwin's database.") .setNSFW(false) //should be true, but fucking discord forces id checks to view NSFW channel. i won't comply. .setDMPermission(true), async execute(interaction) { diff --git a/src/data/commandData.csv b/src/data/commandData.csv index 14e202d6..116ddc6c 100644 --- a/src/data/commandData.csv +++ b/src/data/commandData.csv @@ -25,16 +25,17 @@ 24,ban,moderation,Bans a specified member from the server. 25,purge,moderation,Purges (mass deletes) a specified amount of messages from the current channel. 26,config-autorole,administration,"Sets / modifies / disables the autorole feature. When a new member joins the server, a specified role will get assigned to them automatically." -28,config-welcome,administration,"Sets / modifies / disables the welcome messages feature. When a new member joins the server, the bot send a specified welcome message." -30,config-logging,administration,Sets / modifies / disables the channel where event on the server will get logged -32,config-bridge,administration,Sets / modifies / disables bridging all messages from one channel to another. -34,rename,administration,Renames a specified user to a specified nickname in the current server. -35,slowmode,administration,Sets / disables the slowmode for a specified channel. -36,config-goodbye,administration,"Sets / modifies / disables the goodbye messages feature. When a member leaves the server, the bot send a specified goodbye message." -82,coinflip-fun,fun,Flips a coin that has a 50/50 chance landing on heads or tails. Has an economy (*/coinflip*) version with gambling. -112,blackjack,economy,Lets you play a game of blackjack with a specified amount. You can pick **Hit** or **Stand** until the player or the house wins -192,config-darwin,administration,Sets / modifies / disables Darwin's occasional video scraping & posting feature. -193,cigany,fun,"Says ""fuj"" and sends a random pic of a ""person"" from a specific race." -194,cooldown,economy,Lets you check your or other users economy cooldowns for all or a specified economy command. -195,invite,utility,Gives you back a link for inviting the bot to any server where you have permissions to do so. -652,word-leaderboard,fun,Counts a specified word in the current server and sends back a leaderboard with the users who used that word the most through all their previous messages. +27,config-welcome,administration,"Sets / modifies / disables the welcome messages feature. When a new member joins the server, the bot send a specified welcome message." +28,config-logging,administration,Sets / modifies / disables the channel where event on the server will get logged +29,config-bridge,administration,Sets / modifies / disables bridging all messages from one channel to another. +30,rename,administration,Renames a specified user to a specified nickname in the current server. +31,slowmode,administration,Sets / disables the slowmode for a specified channel. +32,config-goodbye,administration,"Sets / modifies / disables the goodbye messages feature. When a member leaves the server, the bot send a specified goodbye message." +33,coinflip-fun,fun,Flips a coin that has a 50/50 chance landing on heads or tails. Has an economy (*/coinflip*) version with gambling. +34,blackjack,economy,Lets you play a game of blackjack with a specified amount. You can pick **Hit** or **Stand** until the player or the house wins +35,config-darwin,administration,Sets / modifies / disables Darwin's occasional video scraping & posting feature. +36,cigany,fun,"Says ""fuj"" and sends a random pic of a ""person"" from a specific race." +37,cooldown,economy,Lets you check your or other users economy cooldowns for all or a specified economy command. +38,invite,utility,Gives you back a link for inviting the bot to any server where you have permissions to do so. +39,word-leaderboard,fun,Counts a specified word in the current server and sends back a leaderboard with the users who used that word the most through all their previous messages. +40,darwin-random,fun,"Sends back a random, streamable video from Darwin's database." From ea4f2e8699a5dd5d3a023f391b6580550abd6624 Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 22 Nov 2025 22:15:51 +0100 Subject: [PATCH 22/23] bumped version number in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2fa15ea1..f0380cd2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discordbot", - "version": "4.2.0", + "version": "4.2.1", "description": "A simple discord bot of mine developed with discord.js (Node.js).", "type": "module", "main": "index.js", From a16e0a4929676987b39a8bcb97efe7fd55388d4f Mon Sep 17 00:00:00 2001 From: VB2007 Date: Sat, 22 Nov 2025 22:16:00 +0100 Subject: [PATCH 23/23] fixed trigger in wiki update workflow --- .github/workflows/wiki-update.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/wiki-update.yml b/.github/workflows/wiki-update.yml index 36e6c944..d341c079 100644 --- a/.github/workflows/wiki-update.yml +++ b/.github/workflows/wiki-update.yml @@ -2,8 +2,7 @@ name: Update Wiki Commands on: push: - branches: - - main + branches: [main] paths: - "src/data/commandData.csv" workflow_dispatch: