feat(create-discord-bot): bun/deno templates (#9795)

This commit is contained in:
Noel
2023-08-21 22:48:13 +02:00
committed by GitHub
parent 8eb978d32c
commit dd5e7453e8
46 changed files with 700 additions and 115 deletions

View File

@@ -0,0 +1,10 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"tamasfe.even-better-toml",
"codezombiech.gitignore",
"christian-kohler.npm-intellisense",
"christian-kohler.path-intellisense"
]
}

View File

@@ -0,0 +1,13 @@
{
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": false
},
"editor.trimAutoWhitespace": false,
"files.insertFinalNewline": true,
"files.eol": "\n",
"npm.packageManager": "[REPLACE_ME]"
}

View File

@@ -1,5 +1,5 @@
{
"name": "[REPLACE-NAME]",
"name": "[REPLACE_ME]",
"version": "0.1.0",
"private": true,
"type": "module",
@@ -10,14 +10,14 @@
"deploy": "node --require dotenv/config src/util/deploy.js"
},
"dependencies": {
"@discordjs/core": "^0.6.0",
"discord.js": "^14.11.0",
"dotenv": "^16.0.3"
"@discordjs/core": "^1.0.1",
"discord.js": "^14.13.0",
"dotenv": "^16.3.1"
},
"devDependencies": {
"eslint": "^8.40.0",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^2.8.8"
"prettier": "^3.0.2"
}
}

View File

@@ -1,3 +1,4 @@
import process from 'node:process';
import { URL } from 'node:url';
import { Client, GatewayIntentBits } from 'discord.js';
import { loadCommands, loadEvents } from './util/loaders.js';
@@ -14,4 +15,4 @@ const commands = await loadCommands(new URL('commands/', import.meta.url));
registerEvents(commands, events, client);
// Login to the client
void client.login();
void client.login(process.env.DISCORD_TOKEN);

View File

@@ -4,10 +4,10 @@ import { API } from '@discordjs/core/http-only';
import { REST } from 'discord.js';
import { loadCommands } from './loaders.js';
const commands = await loadCommands(new URL('commands/', import.meta.url));
const commands = await loadCommands(new URL('../commands/', import.meta.url));
const commandData = [...commands.values()].map((command) => command.data);
const rest = new REST({ version: '10' }).setToken(process.env.TOKEN);
const rest = new REST({ version: '10' }).setToken(process.env.DISCORD_TOKEN);
const api = new API(rest);
const result = await api.applicationCommands.bulkOverwriteGlobalCommands(process.env.APPLICATION_ID, commandData);