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 toolkit2y 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
ROB0520OP2y 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
Jaworek2y ago
okey can be fixed
ROB0520
ROB0520OP2y ago
how?
ROB0520
ROB0520OP2y ago
could I like test it somehow?
Jaworek
Jaworek2y ago
it will work
ROB0520
ROB0520OP2y ago
welp aight then
Jaworek
Jaworek2y ago
i even added you to pr ;>
ROB0520
ROB0520OP2y ago
yeah I noticed XD
ROB0520
ROB0520OP2y 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
ROB0520OP2y ago
This is for the typescript template
Jaworek
Jaworek2y ago
havent you overwritten your rest package?
ROB0520
ROB0520OP2y 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
Jaworek2y ago
oh yeah its on clear install
ROB0520
ROB0520OP2y ago
any ideas on how to fix it?
Jaworek
Jaworek2y ago
install core as 1.0.0
ROB0520
ROB0520OP2y ago
or do I just copy from discordjs.guide in the meant time? alr
Jaworek
Jaworek2y ago
then rest version will also match
ROB0520
ROB0520OP2y ago
neat that worked, thanks! could you also open a pr for that to get fixed too?
Jaworek
Jaworek2y ago
it would require pr for every version change
ROB0520
ROB0520OP2y ago
ah alright then, I guess Im just gonna keep that in mind when making more bots with the template
ROB0520
ROB0520OP2y 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
ROB0520OP2y ago
Ooh aight
Want results from more Discord servers?
Add your server