.github/assets/cyn-hi-chat-cyn-murder-drones.gif
.github/assets/cyn-hi-chat-cyn-murder-drones.gif
This is a binary file and will not be displayed.
+2
-2
.github/workflows/deno.yml
+2
-2
.github/workflows/deno.yml
+31
.zed/settings.json
+31
.zed/settings.json
···
1
+
{
2
+
"lsp": {
3
+
"deno": {
4
+
"settings": {
5
+
"deno": {
6
+
"enable": true
7
+
}
8
+
}
9
+
}
10
+
},
11
+
"languages": {
12
+
"TypeScript": {
13
+
"language_servers": [
14
+
"deno",
15
+
"!typescript-language-server",
16
+
"!vtsls",
17
+
"!eslint"
18
+
],
19
+
"formatter": "language_server"
20
+
},
21
+
"TSX": {
22
+
"language_servers": [
23
+
"deno",
24
+
"!typescript-language-server",
25
+
"!vtsls",
26
+
"!eslint"
27
+
],
28
+
"formatter": "language_server"
29
+
}
30
+
}
31
+
}
+4
-2
README.md
+4
-2
README.md
···
1
1
<br>
2
-
<h1 align="center">️❄️ Voidy ❄️<br></h1>
2
+
<h1 align="center">️✨ Voidy ✨<br></h1>
3
+
<div align="center"><img src=".github/assets/cyn-hi-chat-cyn-murder-drones.gif" width=200></div>
4
+
<br>
3
5
<div align="center">My powerful discord bot :3</div>
4
6
<br>
5
7
···
19
21
20
22
Additionally, some of the docs and guides used:
21
23
22
-
- [discordjs.guide](https://discordjs.guide)
24
+
- [discordjs.guide](https://discordjs.guide)
+18
-8
src/handlers/CommandHandler.ts
+18
-8
src/handlers/CommandHandler.ts
···
5
5
import { RESTPostAPIChatInputApplicationCommandsJSONBody } from "discord-api-types/rest";
6
6
7
7
export class CommandHandler {
8
-
protected static commands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
8
+
protected static commands: RESTPostAPIChatInputApplicationCommandsJSONBody[] =
9
+
[];
9
10
10
-
public static async loadCommands(client: VoidyClient, paths: string[] = ["src/commands"]) {
11
+
public static async loadCommands(
12
+
client: VoidyClient,
13
+
paths: string[] = ["src/commands"],
14
+
) {
11
15
for (const path of paths) {
12
16
await this.loadFiles(client, path);
13
17
}
···
27
31
28
32
// Grab the bot client id from the BOT_CLIENT_ID environment variable
29
33
const clientId = Deno.env.get("BOT_CLIENT_ID");
30
-
if (!clientId) throw new Error("BOT_CLIENT_ID environment variable is missing");
34
+
if (!clientId) {
35
+
throw new Error("BOT_CLIENT_ID environment variable is missing");
36
+
}
31
37
32
38
// Send a put request to the application commands endpoint, the request body contains an array of all commands
33
39
await rest.put(
···
35
41
{ body: this.commands },
36
42
);
37
43
38
-
console.log(`[Voidy] Successfully deployed ${this.commands.length} commands.`);
39
-
console.log();
44
+
console.log(
45
+
`[Voidy] Successfully deployed ${this.commands.length} commands.\n`,
46
+
);
40
47
}
41
48
42
49
protected static async loadFiles(client: VoidyClient, path: string) {
···
47
54
for await (const walkEntry of walk(path)) {
48
55
if (!walkEntry.isFile) continue;
49
56
50
-
const command: Command = (await import(`file://${Deno.cwd()}/${walkEntry.path}`)).default;
57
+
const command: Command =
58
+
(await import(`file://${Deno.cwd()}/${walkEntry.path}`)).default;
51
59
52
60
if ("data" in command && "execute" in command) {
53
61
client.commands.set(command.data.name, command);
···
55
63
56
64
console.log(`[Voidy] Loaded command: ${command.data.name}`);
57
65
} else {
58
-
console.log(`[Voidy] Command ${walkEntry.path} is missing the "data" or "execute" property.`);
66
+
console.log(
67
+
`[Voidy] Command ${walkEntry.path} is missing the "data" or "execute" property.`,
68
+
);
59
69
}
60
70
}
61
71
} catch {
62
72
console.log(`[Voidy] Directory ${path} doesn't exist`);
63
73
}
64
74
}
65
-
}
75
+
}