tangled
alpha
login
or
join now
vielle.dev
/
discord-donger
0
fork
atom
Discord bot to open dong files
0
fork
atom
overview
issues
pulls
pipelines
scafold open and create
add base content for create
Vielle.dev
1 year ago
a0769dbf
05c81946
+90
-2
3 changed files
expand all
collapse all
unified
split
src
commands
dong
create.ts
open.ts
util
ping.ts
+73
src/commands/dong/create.ts
···
1
1
+
import {
2
2
+
Attachment,
3
3
+
ChatInputCommandInteraction,
4
4
+
SlashCommandBuilder,
5
5
+
} from "discord.js";
6
6
+
import type { customClient } from "../..";
7
7
+
8
8
+
const download = async (file: Attachment): Promise<File> =>
9
9
+
new File(
10
10
+
[
11
11
+
await fetch(file.url).then((res) => {
12
12
+
return res.blob();
13
13
+
}),
14
14
+
],
15
15
+
file.name,
16
16
+
{
17
17
+
type: file.contentType ?? "application/octet-stream",
18
18
+
}
19
19
+
);
20
20
+
21
21
+
export const data = new SlashCommandBuilder()
22
22
+
.setName("create")
23
23
+
.setDescription("Create a dong file!")
24
24
+
.addAttachmentOption((opt) =>
25
25
+
opt
26
26
+
.setName("image")
27
27
+
.setDescription("The image of the dong file")
28
28
+
.setRequired(true)
29
29
+
)
30
30
+
.addAttachmentOption((opt) =>
31
31
+
opt
32
32
+
.setName("audio")
33
33
+
.setDescription("The audio of the dong file")
34
34
+
.setRequired(true)
35
35
+
)
36
36
+
.addStringOption((opt) =>
37
37
+
opt
38
38
+
.setName("name")
39
39
+
.setDescription("Filename of the dong file")
40
40
+
.setRequired(true)
41
41
+
);
42
42
+
export const execute = async (
43
43
+
interaction: ChatInputCommandInteraction & { client: customClient }
44
44
+
) => {
45
45
+
const filename = interaction.options.getString("name", true) + ".dong";
46
46
+
const image = interaction.options.getAttachment("image", true);
47
47
+
const audio = interaction.options.getAttachment("audio", true);
48
48
+
49
49
+
if (!image.contentType?.startsWith("image/")) {
50
50
+
await interaction.reply("Image is not a valid image!");
51
51
+
return;
52
52
+
}
53
53
+
if (!audio.contentType?.startsWith("audio/")) {
54
54
+
await interaction.reply("Audio is not a valid audio!");
55
55
+
return;
56
56
+
}
57
57
+
58
58
+
await interaction.deferReply();
59
59
+
60
60
+
let downloaded = {
61
61
+
image: await download(image),
62
62
+
audio: await download(audio),
63
63
+
};
64
64
+
console.log(downloaded);
65
65
+
await interaction.editReply(`Not implemented! Debug:
66
66
+
\`\`\`
67
67
+
filename: ${filename}
68
68
+
69
69
+
image: ${image.contentType} | ${image.url}
70
70
+
71
71
+
audio: ${audio.contentType} | ${audio.url}
72
72
+
\`\`\``);
73
73
+
};
+17
src/commands/dong/open.ts
···
1
1
+
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
2
2
+
import type { customClient } from "../..";
3
3
+
4
4
+
export const data = new SlashCommandBuilder()
5
5
+
.setName("open")
6
6
+
.setDescription("Open a dong file!")
7
7
+
.addAttachmentOption((opt) =>
8
8
+
opt
9
9
+
.setName("dong")
10
10
+
.setDescription("The dong file")
11
11
+
.setRequired(true)
12
12
+
);
13
13
+
export const execute = async (
14
14
+
interaction: ChatInputCommandInteraction & { client: customClient }
15
15
+
) => {
16
16
+
await interaction.reply("Not Implemented!");
17
17
+
};
-2
src/commands/util/ping.ts
···
1
1
import {
2
2
ChatInputCommandInteraction,
3
3
-
Client,
4
4
-
CommandInteraction,
5
3
SlashCommandBuilder,
6
4
} from "discord.js";
7
5
import type { customClient } from "../..";