Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1ca24d6
updated packages
vb2007 Nov 10, 2025
3ad40c3
created darwin-random command
vb2007 Nov 10, 2025
f81cb0f
created base logic to reply helper
vb2007 Nov 11, 2025
9f70609
updated cdn url in example config json
vb2007 Nov 12, 2025
55d597f
updated reply helper, started formatting message
vb2007 Nov 13, 2025
d658209
renamed, added columns to darwinCache table
vb2007 Nov 13, 2025
fff5f82
fixed merge conflict
vb2007 Nov 21, 2025
3d1f08c
fixed merge conflict in package-lock
vb2007 Nov 21, 2025
453bc33
fixed query in /darwin-random
vb2007 Nov 21, 2025
98c4314
updated message format & query
vb2007 Nov 21, 2025
cc9009e
updated column name in sql file
vb2007 Nov 21, 2025
205dabc
fixed var name in reply helper, updated messageContent formatting
vb2007 Nov 21, 2025
77b37e1
updated processedAt time formatting
vb2007 Nov 21, 2025
fa17c8d
changed processedAt formatting to relative time
vb2007 Nov 21, 2025
1c5c042
removed unused imports
vb2007 Nov 22, 2025
22dc904
removed debug logging
vb2007 Nov 22, 2025
df3dbbd
updated packages
vb2007 Nov 22, 2025
97127ae
made title bold in darwinProcess
vb2007 Nov 22, 2025
a10adea
fdiscord
vb2007 Nov 22, 2025
bceda53
updated darwinCache table schema declaration from prod db DDL
vb2007 Nov 22, 2025
2f1b8d6
removed unneded config values from example config.json file
vb2007 Nov 22, 2025
5c43936
updated commandData + fixed auto increment
vb2007 Nov 22, 2025
ea4f2e8
bumped version number in package.json
vb2007 Nov 22, 2025
a16e0a4
fixed trigger in wiki update workflow
vb2007 Nov 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/wiki-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Update Wiki Commands

on:
push:
branches:
- main
branches: [main]
paths:
- "src/data/commandData.csv"
workflow_dispatch:
Expand Down
6 changes: 1 addition & 5 deletions config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
33 changes: 33 additions & 0 deletions src/commands/fun/darwin-random.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { SlashCommandBuilder } from "discord.js";
import { query } from "../../helpers/db.js";
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.")
.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(
`SELECT directVideoUrl, forumPostUrl, videoTitle, processedAt
FROM darwinCache
WHERE forumPostUrl IS NOT NULL
AND videoTitle IS NOT NULL
ORDER BY RAND()
LIMIT 1`
);

const directVideoUrl = randomVideo[0].directVideoUrl;
const forumPostUrl = randomVideo[0].forumPostUrl;
const videoTitle = randomVideo[0].videoTitle;
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**: <t:${processedAt}:R>`;

await baseReplyAndLog(interaction, messageContent);
},
};
27 changes: 14 additions & 13 deletions src/data/commandData.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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."
2 changes: 1 addition & 1 deletion src/helpers/darwin/darwinProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}**`;
};

/**
Expand Down
5 changes: 5 additions & 0 deletions src/helpers/reply.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ export const replyAndLog = async (interaction, embedReply) => {
await interaction.reply({ embeds: [embedReply] });
await logToFileAndDatabase(interaction, JSON.stringify(embedReply.toJSON()));
};

export const baseReplyAndLog = async (interaction, messageContent) => {
await interaction.reply(messageContent);
await logToFileAndDatabase(interaction, messageContent);
};
19 changes: 10 additions & 9 deletions src/sql/darwinCache/table.sql
Original file line number Diff line number Diff line change
@@ -1,12 +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,
`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`)
);