A powerful and extendable Discord bot, with it's own module system :3 thevoid.cafe/projects/voidy

♻️ Update 'grant' to 'update' and move httpcat to toys module

Jo 36eea7be b131dec9

+41 -20
+10 -10
packages/bot/docker-compose.yml
··· 1 - # Don't change these development defaults, use a docker-compose.override.yml file instead :) 2 - services: 3 - mongo: 4 - image: mongo:latest 5 - container_name: voidy_db 6 - ports: 7 - - "27017:27017" 8 - environment: 9 - MONGO_INITDB_ROOT_USERNAME: voidy 10 - MONGO_INITDB_ROOT_PASSWORD: voidy 1 + # Don't change these development defaults, use a docker-compose.override.yml file instead :) 2 + services: 3 + mongo: 4 + image: mongo:latest 5 + container_name: voidy_db 6 + ports: 7 + - "27017:27017" 8 + environment: 9 + MONGO_INITDB_ROOT_USERNAME: voidy 10 + MONGO_INITDB_ROOT_PASSWORD: voidy
+7 -5
packages/bot/src/index.ts
··· 9 9 10 10 // Database URI validation and connection check 11 11 if (!Bun.env.DB_URI) throw new Error("[Voidy] Missing database URI"); 12 - await connect(Bun.env.DB_URI).then(() => { 13 - console.log("Connected to database"); 14 - }).catch((error) => { 15 - console.error("Failed to connect to database:", error); 16 - }); 12 + await connect(Bun.env.DB_URI) 13 + .then(() => { 14 + console.log("Connected to database"); 15 + }) 16 + .catch((error) => { 17 + console.error("Failed to connect to database:", error); 18 + }); 17 19 18 20 // Token validation and client start 19 21 if (!Bun.env.BOT_TOKEN) throw new Error("[Voidy] Missing bot token");
+3 -1
packages/bot/src/modules/core/commands/api/httpcat.ts packages/bot/src/modules/toys/commands/api/httpcat.ts
··· 10 10 option.setName("code").setDescription("The desired HTTP status code.").setRequired(true), 11 11 ) 12 12 .addBooleanOption((option) => 13 - option.setName("ephemeral").setDescription("Whether to publicly share the bot response"), 13 + option 14 + .setName("ephemeral") 15 + .setDescription("Whether or not to publicly share the bot response"), 14 16 ), 15 17 16 18 execute: async (interaction, _client) => {
+13
packages/bot/src/modules/toys/module.ts
··· 1 + import { CommandLoader } from "@voidy/framework"; 2 + 3 + export default { 4 + id: "toys", 5 + name: "Toys", 6 + description: "Provides various fun commands, e.g. coinflip, dice or simple API interactions", 7 + exports: [ 8 + { 9 + src: `${import.meta.dir}/commands`, 10 + loader: CommandLoader, 11 + }, 12 + ], 13 + };
packages/bot/src/modules/user/commands/consent/grant.ts packages/bot/src/modules/user/commands/consent/update.ts
+8 -4
packages/bot/src/modules/user/schemas/UserConfig.ts
··· 4 4 "UserConfig", 5 5 new Schema({ 6 6 id: { type: String, required: true, primary: true }, 7 - consent: { type: Object, required: true, default: { 8 - storage: { type: Boolean, required: true, default: true }, 9 - statistics: { type: Boolean, required: true, default: true }, 10 - } }, 7 + consent: { 8 + type: Object, 9 + required: true, 10 + default: { 11 + storage: { type: Boolean, required: true, default: true }, 12 + statistics: { type: Boolean, required: true, default: true }, 13 + }, 14 + }, 11 15 }), 12 16 );