diff --git a/.envExemple b/.envExemple index 863edef..ac308ab 100644 --- a/.envExemple +++ b/.envExemple @@ -1,2 +1,2 @@ -DISCORD_TOKEN="" -BOT_ID="" \ No newline at end of file +DISCORD_TOKEN="MTE0MTA2NjU3MTUwMzEyNDU0MA.GJATwt.Q4bVmnbv5pw8s5jTXfnJBOYlDlMsxW0gEn2k24" +BOT_ID="1141066571503124540" diff --git a/.gitignore b/.gitignore index a9022ad..ab793cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ node_modules -package-lock.json -dist -.env \ No newline at end of file +.env +deno.lock diff --git a/DOCKERFILE b/DOCKERFILE deleted file mode 100644 index da34478..0000000 --- a/DOCKERFILE +++ /dev/null @@ -1,4 +0,0 @@ -FROM node:latest -WORKDIR /app -COPY . /app -CMD ["npm", "run", "start"] \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2cc8cd6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM denoland/deno:alpine +WORKDIR /app +COPY . . +CMD ["deno", "run", "start"] diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..91518d7 --- /dev/null +++ b/deno.json @@ -0,0 +1,11 @@ +{ + "tasks": { + "dev": "deno run --allow-env --allow-read --allow-net --watch src/main.ts", + "start": "deno run --allow-env --allow-read --allow-net src/main.ts" + }, + "imports": { + "@std/assert": "jsr:@std/assert@1", + "discord.js": "npm:discord.js@^14.16.3", + "dotenv": "npm:dotenv@^16.4.7" + } +} diff --git a/docker-compose.yml b/docker-compose.yml index 0e158ee..e832d9b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,8 @@ -version: '3.1' - services: - service_name: + discord_bot: build: context: . - dockerfile: DOCKERFILE + dockerfile: Dockerfile + container_name: discord_bot restart: always - volumes: - - /full/path/to/bot:/app \ No newline at end of file + diff --git a/package.json b/package.json deleted file mode 100644 index 775856f..0000000 --- a/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "bot-template-ts", - "version": "1.0.0", - "description": "", - "main": "index.js", - "type": "module", - "scripts": { - "dev": "tsx watch src", - "build": "tsc", - "start": "node dist" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "discord.js": "^14.14.1", - "dotenv": "^16.4.5", - "mysql": "^2.18.1" - } -} diff --git a/src/@types/discord.d.ts b/src/@types/discord.d.ts index ccd37b0..95edbfd 100644 --- a/src/@types/discord.d.ts +++ b/src/@types/discord.d.ts @@ -1,7 +1,7 @@ -import type { Client } from 'discord.js' +import type { Client } from 'npm:discord.js' declare module 'discord.js' { export interface Client extends Client { commands: Collection } -} \ No newline at end of file +} diff --git a/src/commands/default/ping.ts b/src/commands/default/ping.ts index b40c2d0..901d0e6 100644 --- a/src/commands/default/ping.ts +++ b/src/commands/default/ping.ts @@ -1,4 +1,4 @@ -import { SlashCommandBuilder, ChatInputCommandInteraction } from "discord.js"; +import { SlashCommandBuilder, ChatInputCommandInteraction } from "npm:discord.js"; export default { data: new SlashCommandBuilder() diff --git a/src/events/interactionCreate.ts b/src/events/interactionCreate.ts index 03c4322..1720264 100644 --- a/src/events/interactionCreate.ts +++ b/src/events/interactionCreate.ts @@ -1,4 +1,4 @@ -import { Events, Interaction } from "discord.js"; +import { Events, Interaction } from "npm:discord.js"; export default { name: Events.InteractionCreate, diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 794121c..7c26be7 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -1,4 +1,4 @@ -import { Events, Message } from "discord.js"; +import { Events, Message } from "npm:discord.js"; export default { name: Events.MessageCreate, diff --git a/src/events/ready.ts b/src/events/ready.ts index bc9a17e..53c7d35 100644 --- a/src/events/ready.ts +++ b/src/events/ready.ts @@ -1,4 +1,4 @@ -import { Events, Client } from "discord.js"; +import { Events, Client } from "npm:discord.js"; export default { name: Events.ClientReady, diff --git a/src/index.ts b/src/main.ts similarity index 89% rename from src/index.ts rename to src/main.ts index 4ebde80..8daf68a 100644 --- a/src/index.ts +++ b/src/main.ts @@ -1,7 +1,7 @@ -import * as fs from 'fs'; -import * as path from 'path'; -import "dotenv/config"; -import { Client, Collection, REST, Routes, RESTPutAPIApplicationCommandsResult } from 'discord.js'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import "npm:dotenv/config"; +import { Client, Collection, REST, Routes, RESTPutAPIApplicationCommandsResult } from 'npm:discord.js'; const client: Client = new Client({ intents: [], @@ -23,7 +23,7 @@ async function loadCommands() { for (const file of commandFiles) { const filePath = `./commands/${folder}/${file}`; - const command = await import(filePath.replace(".ts", ".js")); + const command = await import(filePath); if ("data" in command.default && "execute" in command.default) { client.commands.set(command.default.data.name, command.default); commands.push(command.default.data.toJSON()); @@ -43,7 +43,7 @@ async function loadEvents() { for (const file of eventFiles) { const filePath = `./events/${file}`; - const event = await import(filePath.replace(".ts", ".js")); + const event = await import(filePath); if (event.default.once) { client.once(event.default.name, (...args) => event.default.execute(...args)); diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index bd66ca5..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "target": "ES5", - "module": "NodeNext", - "moduleResolution": "NodeNext", - "resolveJsonModule": true, - "strict": true, - "outDir": "./dist", - "skipLibCheck": true, - "noImplicitAny": true, - }, - "include": ["src"], -} \ No newline at end of file