···1import {
2- Attachment,
3 AttachmentBuilder,
4 ChatInputCommandInteraction,
5 SlashCommandBuilder,
6} from "discord.js";
7-import type { customClient } from "../..";
8import { createDong } from "../../lib/dong-io.ts";
9import { download } from "../../lib/download.ts";
01011export const data = new SlashCommandBuilder()
12 .setName("create")
···4748 await interaction.deferReply();
4950- let downloaded = {
51 image: await download(image),
52 audio: await download(audio),
53 };
···1import {
02 AttachmentBuilder,
3 ChatInputCommandInteraction,
4 SlashCommandBuilder,
5} from "discord.js";
6+import type { customClient } from "../../index.ts";
7import { createDong } from "../../lib/dong-io.ts";
8import { download } from "../../lib/download.ts";
9+import { Buffer } from "node:buffer";
1011export const data = new SlashCommandBuilder()
12 .setName("create")
···4748 await interaction.deferReply();
4950+ const downloaded = {
51 image: await download(image),
52 audio: await download(audio),
53 };
+1
src/commands/dong/open.ts
···10import { Mime } from "mime";
11import standardTypes from "mime/types/standard.js";
12import otherTypes from "mime/types/other.js";
01314const mime = new Mime(standardTypes, otherTypes);
15mime.define({ "audio/mpeg": ["mp3"] });
···10import { Mime } from "mime";
11import standardTypes from "mime/types/standard.js";
12import otherTypes from "mime/types/other.js";
13+import { Buffer } from "node:buffer";
1415const mime = new Mime(standardTypes, otherTypes);
16mime.define({ "audio/mpeg": ["mp3"] });
+2-5
src/commands/util/ping.ts
···1-import {
2- ChatInputCommandInteraction,
3- SlashCommandBuilder,
4-} from "discord.js";
5-import type { customClient } from "../..";
67export const data = new SlashCommandBuilder()
8 .setName("ping")
···1+import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
2+import type { customClient } from "../../index.ts";
00034export const data = new SlashCommandBuilder()
5 .setName("ping")
+7-5
src/index.ts
···8 type Interaction,
9} from "discord.js";
10import { glob } from "node:fs/promises";
11-import path from "node:path";
1213-console.log(process.env);
14-15-const token = process.env.TOKEN;
16if (!token) throw new Error("Token required. Please fill in TOKEN in .env");
17console.log("Token Valid!");
18···42for await (const file of glob("src/commands/**/*.ts", {
43 exclude: ["node_modules"],
44})) {
45- const command = await import("file:///" + path.join(__dirname, "..", file));
046 // check command contains all required properties
47 if (
48 "data" in command &&
···76 console.error(`No command ${interaction.commandName}`);
77 return;
78 }
00007980 try {
81 await command.execute(interaction);
···8 type Interaction,
9} from "discord.js";
10import { glob } from "node:fs/promises";
01112+const token = Deno.env.get("TOKEN");
0013if (!token) throw new Error("Token required. Please fill in TOKEN in .env");
14console.log("Token Valid!");
15···39for await (const file of glob("src/commands/**/*.ts", {
40 exclude: ["node_modules"],
41})) {
42+ console.log(file);
43+ const command = await import(`../${file}`);
44 // check command contains all required properties
45 if (
46 "data" in command &&
···74 console.error(`No command ${interaction.commandName}`);
75 return;
76 }
77+78+ console.log(
79+ `Got command /${interaction.commandName} from @${interaction.user.username}`
80+ );
8182 try {
83 await command.execute(interaction);
···4 }
5}
67+const blobBytes = (blob: Blob) => {
8 if ("bytes" in blob) return blob.bytes();
9 return new Response(blob).arrayBuffer().then((buffer) => {
10 const uint = new Uint8Array(buffer);
···107 },
108 };
109}
00000000000
+5-1
src/sync.js
···1import { REST, Routes } from "discord.js";
2-const { CLIENT: clientId, TOKEN: token } = process.env;
3import fs from "node:fs";
4import path from "node:path";
0000056const commands = [];
7// Grab all the command folders from the commands directory you created earlier
···1import { REST, Routes } from "discord.js";
02import fs from "node:fs";
3import path from "node:path";
4+5+const clientId = Deno.env.get("CLIENT");
6+const token = Deno.env.get("TOKEN");
7+if (!clientId) throw "CLIENT not defined";
8+if (!token) throw "TOKEN not defined";
910const commands = [];
11// Grab all the command folders from the commands directory you created earlier