mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
feat(create-discord-bot): bun/deno templates (#9795)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user