tangled
alpha
login
or
join now
thevoid.cafe
/
voidy
0
fork
atom
A powerful and extendable Discord bot, with it's own module system :3
thevoid.cafe/projects/voidy
0
fork
atom
overview
issues
pulls
pipelines
♻️ Update 'grant' to 'update' and move httpcat to toys module
Jo
3 months ago
36eea7be
b131dec9
+41
-20
6 changed files
expand all
collapse all
unified
split
packages
bot
docker-compose.yml
src
index.ts
modules
toys
commands
api
httpcat.ts
module.ts
user
commands
consent
update.ts
schemas
UserConfig.ts
+10
-10
packages/bot/docker-compose.yml
···
1
1
-
# Don't change these development defaults, use a docker-compose.override.yml file instead :)
2
2
-
services:
3
3
-
mongo:
4
4
-
image: mongo:latest
5
5
-
container_name: voidy_db
6
6
-
ports:
7
7
-
- "27017:27017"
8
8
-
environment:
9
9
-
MONGO_INITDB_ROOT_USERNAME: voidy
10
10
-
MONGO_INITDB_ROOT_PASSWORD: voidy
1
1
+
# Don't change these development defaults, use a docker-compose.override.yml file instead :)
2
2
+
services:
3
3
+
mongo:
4
4
+
image: mongo:latest
5
5
+
container_name: voidy_db
6
6
+
ports:
7
7
+
- "27017:27017"
8
8
+
environment:
9
9
+
MONGO_INITDB_ROOT_USERNAME: voidy
10
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
12
-
await connect(Bun.env.DB_URI).then(() => {
13
13
-
console.log("Connected to database");
14
14
-
}).catch((error) => {
15
15
-
console.error("Failed to connect to database:", error);
16
16
-
});
12
12
+
await connect(Bun.env.DB_URI)
13
13
+
.then(() => {
14
14
+
console.log("Connected to database");
15
15
+
})
16
16
+
.catch((error) => {
17
17
+
console.error("Failed to connect to database:", error);
18
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
13
-
option.setName("ephemeral").setDescription("Whether to publicly share the bot response"),
13
13
+
option
14
14
+
.setName("ephemeral")
15
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
1
+
import { CommandLoader } from "@voidy/framework";
2
2
+
3
3
+
export default {
4
4
+
id: "toys",
5
5
+
name: "Toys",
6
6
+
description: "Provides various fun commands, e.g. coinflip, dice or simple API interactions",
7
7
+
exports: [
8
8
+
{
9
9
+
src: `${import.meta.dir}/commands`,
10
10
+
loader: CommandLoader,
11
11
+
},
12
12
+
],
13
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
7
-
consent: { type: Object, required: true, default: {
8
8
-
storage: { type: Boolean, required: true, default: true },
9
9
-
statistics: { type: Boolean, required: true, default: true },
10
10
-
} },
7
7
+
consent: {
8
8
+
type: Object,
9
9
+
required: true,
10
10
+
default: {
11
11
+
storage: { type: Boolean, required: true, default: true },
12
12
+
statistics: { type: Boolean, required: true, default: true },
13
13
+
},
14
14
+
},
11
15
}),
12
16
);