create-discord-bot issues

Im trying to run npx create-discord-bot . --typescript and for some reason, rather than creating the files, it just opens an index.mjs file. Any ideas what could be the fix for it?
25 Replies
d.js toolkit
d.js toolkit16mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
ROB0520
ROB0520OP16mo ago
welp I found a "work around" for it which would be running the .mjs file after running the npx command. But Id like to know how to fix it cause it is annoying to do
Jaworek
Jaworek16mo ago
okey can be fixed
ROB0520
ROB0520OP16mo ago
how?
ROB0520
ROB0520OP16mo ago
could I like test it somehow?
Jaworek
Jaworek16mo ago
it will work
ROB0520
ROB0520OP16mo ago
welp aight then
Jaworek
Jaworek16mo ago
i even added you to pr ;>
ROB0520
ROB0520OP16mo ago
yeah I noticed XD
ROB0520
ROB0520OP16mo ago
Also I wanna add that in the src/util/deploy.ts file at line 11. Its giving the error
Type 'REST' is missing the following properties from type 'REST': requestManager, getAgent, raw
Type 'REST' is missing the following properties from type 'REST': requestManager, getAgent, raw
ROB0520
ROB0520OP16mo ago
This is for the typescript template
Jaworek
Jaworek16mo ago
havent you overwritten your rest package?
ROB0520
ROB0520OP16mo ago
no? This is the entire file content, and I didnt change anything from the template when I did my "workaround"
import process from 'node:process';
import { URL } from 'node:url';
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 commandData = [...commands.values()].map((command) => command.data);

const rest = new REST({ version: '10' }).setToken(process.env.TOKEN!);
const api = new API(rest);

const result = await api.applicationCommands.bulkOverwriteGlobalCommands(process.env.APPLICATION_ID!, commandData);

console.log(`Successfully registered ${result.length} commands.`);
import process from 'node:process';
import { URL } from 'node:url';
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 commandData = [...commands.values()].map((command) => command.data);

const rest = new REST({ version: '10' }).setToken(process.env.TOKEN!);
const api = new API(rest);

const result = await api.applicationCommands.bulkOverwriteGlobalCommands(process.env.APPLICATION_ID!, commandData);

console.log(`Successfully registered ${result.length} commands.`);
though is the API class a new thing? Ive never used it before nor have I heard of the bulkOverwriteGlobalCommands function
Jaworek
Jaworek16mo ago
oh yeah its on clear install
ROB0520
ROB0520OP16mo ago
any ideas on how to fix it?
Jaworek
Jaworek16mo ago
install core as 1.0.0
ROB0520
ROB0520OP16mo ago
or do I just copy from discordjs.guide in the meant time? alr
Jaworek
Jaworek16mo ago
then rest version will also match
ROB0520
ROB0520OP16mo ago
neat that worked, thanks! could you also open a pr for that to get fixed too?
Jaworek
Jaworek16mo ago
it would require pr for every version change
ROB0520
ROB0520OP16mo ago
ah alright then, I guess Im just gonna keep that in mind when making more bots with the template
ROB0520
ROB0520OP16mo ago
thanks for helping me out btw! Ill just mark this post as solved once https://github.com/discordjs/discord.js/pull/9747 is merged already
GitHub
fix(create-discord-bot): add shebang in main file by jaw0r3k · Pull...
Please describe the changes this PR makes and why it should be merged: Bug intoduced in #9570 Found in djs-questions post by rob0520 Status and versioning classification: This PR only includes non...
ROB0520
ROB0520OP16mo ago
Ooh aight
Want results from more Discord servers?
Add your server