Changed to deno suport
This commit is contained in:
parent
ac0672f13a
commit
13df5eb10d
14 changed files with 35 additions and 60 deletions
|
@ -1,2 +1,2 @@
|
||||||
DISCORD_TOKEN=""
|
DISCORD_TOKEN="MTE0MTA2NjU3MTUwMzEyNDU0MA.GJATwt.Q4bVmnbv5pw8s5jTXfnJBOYlDlMsxW0gEn2k24"
|
||||||
BOT_ID=""
|
BOT_ID="1141066571503124540"
|
||||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
||||||
node_modules
|
node_modules
|
||||||
package-lock.json
|
|
||||||
dist
|
|
||||||
.env
|
.env
|
||||||
|
deno.lock
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
FROM node:latest
|
|
||||||
WORKDIR /app
|
|
||||||
COPY . /app
|
|
||||||
CMD ["npm", "run", "start"]
|
|
4
Dockerfile
Normal file
4
Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
FROM denoland/deno:alpine
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
CMD ["deno", "run", "start"]
|
11
deno.json
Normal file
11
deno.json
Normal file
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,8 @@
|
||||||
version: '3.1'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
service_name:
|
discord_bot:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: DOCKERFILE
|
dockerfile: Dockerfile
|
||||||
|
container_name: discord_bot
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
|
||||||
- /full/path/to/bot:/app
|
|
||||||
|
|
20
package.json
20
package.json
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
2
src/@types/discord.d.ts
vendored
2
src/@types/discord.d.ts
vendored
|
@ -1,4 +1,4 @@
|
||||||
import type { Client } from 'discord.js'
|
import type { Client } from 'npm:discord.js'
|
||||||
|
|
||||||
declare module 'discord.js' {
|
declare module 'discord.js' {
|
||||||
export interface Client extends Client {
|
export interface Client extends Client {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { SlashCommandBuilder, ChatInputCommandInteraction } from "discord.js";
|
import { SlashCommandBuilder, ChatInputCommandInteraction } from "npm:discord.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Events, Interaction } from "discord.js";
|
import { Events, Interaction } from "npm:discord.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: Events.InteractionCreate,
|
name: Events.InteractionCreate,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Events, Message } from "discord.js";
|
import { Events, Message } from "npm:discord.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: Events.MessageCreate,
|
name: Events.MessageCreate,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Events, Client } from "discord.js";
|
import { Events, Client } from "npm:discord.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: Events.ClientReady,
|
name: Events.ClientReady,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'node:fs';
|
||||||
import * as path from 'path';
|
import * as path from 'node:path';
|
||||||
import "dotenv/config";
|
import "npm:dotenv/config";
|
||||||
import { Client, Collection, REST, Routes, RESTPutAPIApplicationCommandsResult } from 'discord.js';
|
import { Client, Collection, REST, Routes, RESTPutAPIApplicationCommandsResult } from 'npm:discord.js';
|
||||||
|
|
||||||
const client: Client = new Client({
|
const client: Client = new Client({
|
||||||
intents: [],
|
intents: [],
|
||||||
|
@ -23,7 +23,7 @@ async function loadCommands() {
|
||||||
|
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const filePath = `./commands/${folder}/${file}`;
|
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) {
|
if ("data" in command.default && "execute" in command.default) {
|
||||||
client.commands.set(command.default.data.name, command.default);
|
client.commands.set(command.default.data.name, command.default);
|
||||||
commands.push(command.default.data.toJSON());
|
commands.push(command.default.data.toJSON());
|
||||||
|
@ -43,7 +43,7 @@ async function loadEvents() {
|
||||||
|
|
||||||
for (const file of eventFiles) {
|
for (const file of eventFiles) {
|
||||||
const filePath = `./events/${file}`;
|
const filePath = `./events/${file}`;
|
||||||
const event = await import(filePath.replace(".ts", ".js"));
|
const event = await import(filePath);
|
||||||
|
|
||||||
if (event.default.once) {
|
if (event.default.once) {
|
||||||
client.once(event.default.name, (...args) => event.default.execute(...args));
|
client.once(event.default.name, (...args) => event.default.execute(...args));
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ES5",
|
|
||||||
"module": "NodeNext",
|
|
||||||
"moduleResolution": "NodeNext",
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"strict": true,
|
|
||||||
"outDir": "./dist",
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"noImplicitAny": true,
|
|
||||||
},
|
|
||||||
"include": ["src"],
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue