#create-discord-bot
479 messages · Page 1 of 1 (latest)
I'm getting some errors picked up by ESLint in the template directory, but the lint script does not check that. Should that be tweaked?
@suneettipirneni missed this (and the JavaScript version)?
38165fb fix: remove uneeded listeners - suneettipirneni
as I rember from my case
exiting program here will make it undefined
so you should check if it isnt
Which application or package is this feature request for?
create-discord-bot
Feature
I really like the progress so far with this package, but there are a few things I'd like to request to do with the TypeScript template:
-
It would be a good idea for the tool to not install the packages automatically so the user can install them whenever they want.
-
Upon running the command using the TypeScript template, and waiting for everything to install. It shows this error [here](ht...
Please describe the changes this PR makes and why it should be merged:
Resolves: #9603
copilot:walkthrough
Status and versioning classification:
- Code changes have been tested against the Discord API, or there are no code changes
- I know how to update typings and have done so, or typings don't need updating
- This PR changes the library's interface (methods or parameters added)
I see it was changed in https://github.com/discordjs/discord.js/pull/9570 too, so ignore this. That said, changing it here and in that PR will probably cause merge conflicts
Description:
Hey!
This pull request aims to enhance the project configuration process and make it more user-friendly and enjoyable.
Changes Made:
- Implemented a guided prompt system using the
@clack/promptslibrary to provide users with a smoother and more intuitive project setup experience. - Improved the style of messages displayed during the project configuration.
Testing:
Manually tested the project setup process, ensuring that the prompts fun...
Why couldn't this have been merged earlier?
Pardon me, I meant, why wasn't this merged at all?
const rest = new REST().setToken(process.env.TOKEN);
const rest = new REST().setToken(process.env.TOKEN!);
/** @type {import('../events/index.js').Event<Events.InteractionCreate>} */
/** @type {import('./index.js').Event<Events.ClientReady>} */
const interactionCreateEvent: Event<Events.InteractionCreate> = {
/** @type {import('./index.js').Event<Events.ClientReady>} */
Is there a specific reason you want to do this? It seems to be more of a stylistic choice.
Because I think it's a good idea to use these enums when possible.
* Defines the structure of a command.
*
* @typedef {object} Command
Just another nitpick
* @type {import('../util/loaders.js').StructurePredicate<Command>}
This doesn't accept a predicate, it is a predicate
directoryStats already exists, isn't this redundant?
eb1e460 fix: remaining requested changes - suneettipirneni
* @property {import('discord.js').RESTPostAPIApplicationCommandsJSONBody} data The data for the command
* @property {(interaction: import('discord.js').CommandInteraction) => Promise<void> | void} execute The function to execute when the command is called
Nitpick to make it fit with the Event typedef
This may be completely redundant too? Since something similar is already done prior to this.
/**
* Defines the predicate to check if an object is a valid Event type.
*
* @type {import('../util/loaders').StructurePredicate<Event>}
* @returns {structure is Event}
*/
Nitpick to make it fit with the command predicate
91cd061 chore: requested changes - suneettipirneni
Still redundant, this line doesn't do anything except for throwing an error if a file (not a directory) of this name already exists, in which case it would be nice to have an error message.
7fa1865 fix: remove redundant call - suneettipirneni
84f1b18 feat(create-discord-bot): Add prompts, command ... - suneettipirneni
Please describe the changes this PR makes and why it should be merged:
Throw an error if the given directory is not actually a directory.
See #9570 (review).
Status and versioning classification:
- Code changes have been tested against the Discord API, or there are no code changes
- I know how to update typings and have done so, or typings don't need updating
351a18b feat(create-discord-bot): throw error if the di... - D4isDAVID
Please describe the changes this PR makes and why it should be merged:
Found in [djs-questions post](#1136741339476803728 message)
Status and versioning classification:
- This PR only includes non-code changes, like changes to documentation, README, etc.
Disable eslint rule n/shebang for this line
Which application or package is this feature request for?
create-discord-bot
Feature
Every version update can cause errors like that
As templates dont have ^workspace things
Ideal solution or implementation
While publishing create-discord-bot package the script could use latest versions for the templates
Alternative solutions or implementations
No response
...
well its listed in pr description so idk
but idk if making another pr just for that is worth it
58d9024 chore(create-discord-bot): release create-disco... - iCrawl
41d55e4 chore(create-discord-bot): release create-disco... - iCrawl
55e375f feat(create-discord-bot): bun/deno templates - iCrawl
Please describe the changes this PR makes and why it should be merged:
Status and versioning classification:
its definitely not necessary
Do we really need console.log in every case?
} satisfies Event<Events.ClientReady>;
} satisfies Event<Events.ClientReady>;
`yarn set version stable`,
`yarn config set nodeLinker node-modules`,
`yarn config set logFilters --json '[{ "code": "YN0002", "level": "discard" }, { "code": "YN0013", "level": "discard" }, { "code": "YN0032", "level": "discard" }, { "code": "YN0060", "level": "discard" }]'`,
`yarn plugin import interactive-tools`,
`yarn plugin import workspace-tools`,
just cleaner code
It's only for some to create proper spacing in the terminal output.
One console.log before switch statement isnt enough? Without duplicating it in every case
I don't think it matters too much does it, the packageManager here cannot be anything different anyway
just change it to
if (packageManager === 'yarn')
and use one console.log
But I also want to use the console log only on yarn, pnpm, and deno. I can make a default case and get rid of one statement and make a default instead.
dd5e745 feat(create-discord-bot): bun/deno templates (#... - iCrawl
Which package is this bug report for?
create-discord-bot
Issue description
Seems like create-discord-bot is not working properly and esling is being configured wrong from my understanding.
What I did:
Installed the eslint extension.
npx create-discord-bot . and installed the typescript version
I then get in vscode the following:
Missing file extension "ts" for "./util/loaders.js" for all the imports
Code sample
No response
Versions
Everything is latest versio...
Please describe the changes this PR makes and why it should be merged:
There still occurs picocolors is a CommonJS module issue but is going to be fixed in crawl's pnpm pr
Statement checking if we are not using deno:
Why?
Deno doesnt need package..json
allowSyntheticDefaultImports rule:
Why?
node:process doesnt work
allowImportingTsExtensions rule...
Which package is this bug report for?
create-discord-bot
Issue description
- Build the create-discord-bot package
- Run the dist file with deno
Code sample
No response
Versions
deno 1.36.2 (release, x86_64-pc-windows-msvc)
v8 11.7.439.1
typescript 5.1.6
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
Not applica...
Which application or package is this feature request for?
create-discord-bot
Feature
Creating a template using a GitHub repository
Ideal solution or implementation
I think we can provide a function that first checks if the GitHub repository is found, and then downloads and renames the repository.
Alternative solutions or implementations
No response
Other context
No response
This seems like a fundamental Git query accomplished with git clone [email protected]:filename24/filename24.git renamed, for example, no?
This seems like a fundamental Git query accomplished with
git clone [email protected]:filename24/filename24.git renamedfor example, no?
Yes, that's right, but if you look at the code, you're doing a git clone using the [REPLACE_ME] name in the package.json.
I'm struggling to understand now. Isn't the solution to that to follow the respective repository's instructions?
If you're going to write a template, you're most likely going to write a git clone. But if you're going to do a create-discord-bot, why not build something that installs the module, automatically removes the cloned .git fullder, and automatically does a git init, for example create-discord-bot hellobot --example https://github.com?
Please describe the changes this PR makes and why it should be merged:
The module in tsconfig.json was changed as it was causing an error because since the moduleResolution is set to NodeNext, it must also be set to NodeNext.
Please describe the changes this PR makes and why it should be merged:
Running: npm create [email protected] throws commonjs module error coused by importing picocolor
Status and versioning classification:
- This PR only includes non-code changes, like changes to documentation, README, etc.
8a6045f fix: import picocolors as default (#9949) - jaw0r3k
e8bd354 feat: bump package versions - Jiralite
Bumps dependency versions due to recent releases.
cad1589 chore(create-discord-bot): release create-disco... - vladfrangu
Which package is this bug report for?
create-discord-bot
Issue description
Steps
- Do
yarn create discord-bot. - In options use typescript.
- In src/util/deploy.ts, error occurs.
Argument of type 'import("(location of bot code)/node_modules/@discordjs/rest/dist/index").REST' is not assignable to parameter of type 'import("(location of bot code)/node_modules/@discordjs/rest/dist/index", { assert: { "resolution-mode": "import" } }).REST'.
Property '#private' in type...
Doesnt seem working for me...
Updated versions:
Please describe the changes this PR makes and why it should be merged:
There was a typo in create-discord-bot for Bun/TypeScript template which caused it to throw errors at time of install.
Status and versioning classification:
@jaw0r3k please npm ls @discordjs/rest 🙏
@jaw0r3k please
npm ls @discordjs/rest🙏
I also have the same issue:
├─┬ @discordjs/[email protected] │ ├── @discordjs/[email protected] │ └─┬ @discordjs/[email protected] │ └── @discordjs/[email protected] deduped └─┬ [email protected] └── @discordjs/[email protected] deduped
ce0be39 fix(Bun): Fix typo for Bun template (#9987) - BlankParticle
PR is blocked till we get a resolution for https://github.com/microsoft/TypeScript/issues/56455 🤞
For those that find this PR before that is resolved, a solution is importing directly from @discordjs/rest since it has exports for both module types that TS resolves properly.
PR is blocked till we get a resolution for microsoft/TypeScript#56455 🤞
Just as an FYI, this was marked as working as intended on the TS repo.
Which unfortunately means my previous suggestion is the best way to overcome this. I think we plan on making it work by faking djs having esm support in TS land, which is incredibly dumb, and balloons the package size for literally no reason, but alas.
136c66c build: Bump versions (#9986) - Jiralite
e4bff42 Merge branch 'main' of https://github.com/disco... - suneettipirneni
Well it shouldnt
But it do
But i have latest version and promises cp exists
And the function was added to promises struct so maybe i am doing something wrong https://github.com/littledivy/deno/blob/20bb2c8daaba6b78710a24014828f3db90e4e807/ext/node/polyfills/fs.ts#L141
Seems like a deno issue still? Should probably open another one on their end.
Please describe the changes this PR makes and why it should be merged:
This improves the structure validation for command and event types with zod.
Status and versioning classification:
- Code changes have been tested against the Discord API, or there are no code changes
- I know how to update typings and have done so, or typings don't need updating
…to address type checking issues
Please describe the changes this PR makes and why it should be merged:
This PR updates the tsconfig.json file by enabling strictNullChecks, noEmit, and allowImportingTsExtensions options. These changes improve the type checking process by ensuring that null and undefined values are handled correctly, preventing type-related runtime errors. Furthermore, the noEmit option is set to true to enable type-checking without compiling the code, suitab...
How does the noEmit suit the build process in package.json which only calls tsc and nothing else? If it doesn’t emit then there won’t be files to run.
Does 1.40.4 still have this issue, as https://github.com/denoland/deno/pull/22263 was a part of it?
This error was fixed.
But there is a next strange one
<img src="https://github.com/discordjs/discord.js/assets/76836550/62b394ba-3870-45a6-bd70-7b1d4d4da4e6" height="60px" />
As the structure is created as:
<img src="https://github.com/discordjs/discord.js/assets/76836550/a61db354-1321-4fef-b6e4-e639867108c4" height="100px" />
So somehow is is created within Typescript folder
Since this was a Deno issue and not a discord.js issue, I'll be closing this.
This error was fixed. But there is another strange one <img alt="" height="60px" src="https://private-user-images.githubusercontent.com/76836550/304757990-62b394ba-3870-45a6-bd70-7b1d4d4da4e6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTc5NTE3NjYsIm5iZiI6MTcxNzk1MTQ2NiwicGF0aCI6Ii83NjgzNjU1MC8zMDQ3NTc5OTAtNjJiM...
8d73e78 fix: failed build in node and bad lints - almeidx
Please describe the changes this PR makes and why it should be merged:
The typescript build was failing for bots created under node.js due to the usage of .ts imports
ESLint was also failing due to the strictNullChecks tsconfig option not being enabled
After fixing the build, prettier was formatting the files in the dist folder
Status and versioning classification:
- Code changes have been tested against the Discord API, or there are no code changes
Rather than enable this single option, please turn extends into an array and add @sapphire/ts-config to it that includes many options that might have been thought to be included in extra-strict
Which package is this bug report for?
create-discord-bot
Issue description
- Run
npx create-discord-bot, electing to use TypeScript - Allow the bot to set up the template in a directory
cdinto the directorynpm run build
Error reproduces on step 5.
Code sample
No response
Versions
- discord.js 14.16.0
- @discordjs/core 1.2.0
- Node.js 20.11.0
- TypeScript 5.5.4
- MacOS Sequoia 15.2
Issue priority
Medium (should be fixed soon)
Which ...
a111cdd feat: Upgrade create-discord-bot dependencies (... - Jiralite
b744af7 chore(create-discord-bot): release create-disco... - vladfrangu
ad0d9a2 chore(create-discord-bot): release create-disco... - almeidx
If you mean this should be a tool to install anyone's template, we will not be doing that. This is the template. Follow a repository's instructions to learn how to deal with their templates.
With recent changes, this should no longer be an issue.
Which package is this bug report for?
create-discord-bot
Issue description
Steps to reproduce:
- Run
npm create discord-bot - Select JavaScript template
- Create folder named utility in the commands folder.
- Add user command in the
utilitysubdirectory
./commands/utility/user.js
/** @type {import('../index').Command} */
export default {
data: {
name: 'user',
description: 'Provides information about the user.',
},
async execute(interaction) {
await intera...
I believe the Deno template needs this too. Would you mind checking? The code there more or less seems identical.
I believe the Deno template needs this too. Would you mind checking? The code there more or less seems identical.
done
since we use that URL twice now (here and 4 lines earlier) shouldn't it be defined as a const and be used twice for performance reasons?
44e186b refactor(constants): update guide URL - Jiralite
Pointing the guide to the updated one rather than the stale one.
Which package is this bug report for?
create-discord-bot
Issue description
The problem is at https://github.com/discordjs/discord.js/blob/main/packages/create-discord-bot/template/TypeScript/src/util/loaders.ts#L60
const structure = (await import(`${dir}/${file}`)).default; gives no problem on Windows
Code sample
Versions
The NodeJS version is shown in th...
f1addeb refactor: remove registerEvents function - sdanialraza
Please describe the changes this PR makes and why it should be merged:
Removes the registerEvents util function:
- Moved the
interactionCreateevent to the events folder, the commands loading is also done there now - Moved loading event handlers to index
[Internal Discussion](#internals message)
This doesn't appear to be correct. Missing .bind(client) when registering the events. Also applies to the other templates
Why do this? It would be valid to access this.data from within the execute() function, but typescript would disallow you to do that now.
Ah, accidentally added that to commands/index.ts instead of events/index.ts, fixed now
Same question though, an event‘s execute could also have some reason to access this.name or once.
Why don't we do another good practice thing and wrap the event.execute in a try-catch?
if execute is async this try block doesn't do anything
applies to other places as well
9fe59cf chore: bump discord.js across create-discord-x ... - vladfrangu
Please describe the changes this PR makes and why it should be merged:
New release, new template bumps
One of these days we should really make these replacers that happen when the template gets dropped in the file system (and move deno to import mappings >.>)
Status and versioning classification:
- I know how to update typings and have done so, or typings don't need updating
- This PR only includes non-code changes, like changes to documentation, README, etc.
Please describe the changes this PR makes and why it should be merged:
Bumps create-discord-bot (and create-discord-app) to 4.0.0 for consistency (discord-app is at 3.1.0 right now, while discord-bot is at 1.x)
Also adds in a CI step for the multi-deploy, but might not be ideal, @iCrawl would love thoughts
Status and versioning classification:
- This PR only includes non-code changes, like changes to documentation, README, etc.
5e6459f chore: fix create-discord-bot -> create-discord... - vladfrangu
Please describe the changes this PR makes and why it should be merged:
Fixes prettier linting when the script is called
Status and versioning classification:
e70e034 chore: readme for bun - vladfrangu
cd76c9a chore: fix create-discord-bot -> create-discord... - vladfrangu
Please describe the changes this PR makes and why it should be merged:
The target node version being set to 22.12.0 allows create-discord-bot to become a lot smaller in terms of dependency count:
node:fs/promises'globwas added in node 22.0.0. we can use it instead offast-globsince we don't need any fast-glob exclusive functionality.node:util's [styleText](https://nodejs.org/api/util.html#utilstylet...
Please describe the changes this PR makes and why it should be merged:
PR: adding deno command on README.md and PackManager.ts
Status and versioning classification:
Just Noticed the deno command is missing from README.md and PackageManager so that's the main reason
728d6f3 feat: bump discord.js in create-discord-bot/app - vladfrangu
Please describe the changes this PR makes and why it should be merged:
Title says it all
Status and versioning classification:
c0e37cb refactor: update deno template and loader logic - almeidx
- Add
denodetection to the default package manager option - Use import attributes instead of the deprecated import assertions
- Updated the deno template to use the
importsoption, to avoid including the version of packages in every import- This simplifies dependency updates
- Updated TypeScript templates to use descriptive type parameter names
- Rewrote the
loadStructuresfunction to use theglobfunction from node:fs/promises
@Jiralite I can work on this issue. Can I get it assigned as part of Hacktober fest 2025?
e8ea21e chore(create-discord-bot): release create-disco... - Jiralite
conventional-recommended-bump wanted to use 5.0.0. Specifying "monoRepo": true seems to fix that.
719f7b7 chore: migrate eslint configs - sdanialraza
Please describe the changes this PR makes and why it should be merged:
Migrates ESLint configs to the flag config format.
Upgrade zod to v4 on the create-discord-bot templates.
Shouldn't the key here be a string?
fe4fce5 feat: use native node typescript - almeidx
- Adapted the TypeScript template for native ts support on Node.js
- Added the templates to the pnpm-workspace on this repository, to ease dependency management
- This means the templates had to have unique and valid names, so I had to refactor the logic on the package a bit
- Removed tamasfe.even-better-toml from the recommended dependencies, because it seems completely random?
- Added pnpm-lock.yaml to .prettierignore
d923e90 chore: migrate eslint configs (#11234) - sdanialraza
won't this be wrong if running with pnpm or yarn now?
no. but ill make it more clear
Pull request overview
This PR modernizes the TypeScript templates to leverage Node.js's native TypeScript execution, eliminating the need for a build step. The templates are also integrated into the pnpm workspace for better dependency management, requiring unique package names. Additionally, an unrelated VS Code extension recommendation has been removed, and pnpm-lock.yaml is now excluded from Prettier formatting.
- Removed TypeScript transpilation requirement by using
.tsfile extens...
The module and moduleResolution options are set to "NodeNext", but for Bun projects, "Bundler" resolution is more appropriate. Bun has its own module resolution algorithm that differs from Node.js, and "Bundler" mode is designed for bundlers and runtimes like Bun.
Consider changing:
"module": "NodeNext",
"moduleResolution": "NodeNext",
to:
"module": "ESNext",
"moduleResolution": "Bundler",
"module": "ESNext",
"moduleResolution": "Bundler",
Empty placeholder file contains only export {};. This appears to be a minimal placeholder to make the file a valid TypeScript module, but it doesn't implement any actual bot functionality. This should either be removed or replaced with actual implementation code before release.
Consider either:
- Implementing the actual bot initialization code (similar to the Node.js TypeScript template at
packages/create-discord-bot/template/TypeScript/src/index.ts) - Removing this file if it's not ne...
Missing erasableSyntaxOnly compiler option. The TypeScript template includes "erasableSyntaxOnly": true in its tsconfig.json (line 6), but this Bun TypeScript template doesn't. Since both templates are meant to support native TypeScript execution, they should have consistent compiler options.
Add the missing option:
"compilerOptions": {
"allowImportingTsExtensions": true,
"erasableSyntaxOnly": true,
"declaration": false,
// ...
}
"allowImportingTsExtensi...
Empty placeholder file contains only console.log() without any arguments. This will output undefined to the console. This appears to be a placeholder that should either be removed or replaced with actual implementation code before release, or at minimum should log a meaningful message.
Consider either:
- Implementing the actual bot initialization code (similar to other templates)
- Removing this file if it's not needed
- Adding a meaningful placeholder message: `console.log('Bot start...
05f5428 Update packages/create-discord-bot/template/Bun... - almeidx
38d5290 Change module and moduleResolution to ESNext an... - almeidx
Closes #11346
This PR implements Bun templates for the create-discord-bot package:
- Added TypeScript Bun template with complete src structure and configuration
- Added JavaScript Bun template with complete src structure and configuration
- Both templates mirror the Node.js versions with Bun-specific configuration
The templates include:
src/index.ts/src/index.js- Main bot entry pointsrc/util/deploy.ts/src/util/deploy.js- Command deployment utility- `package...
Summary
Implements complete Bun templates for create-discord-bot, both TypeScript and JavaScript versions.
- TypeScript template (
template/Bun/TypeScript/) - JavaScript template (
template/Bun/JavaScript/)
Each template includes:
src/index.{ts,js}- Main entry point using Bun.envsrc/commands/- Command structure with ping and user commandssrc/events/- Event handlers (ready, interactionCreate)src/util/loaders.{ts,js}- File loader usingBun.Globand `Bu...
This pull request allows the template to be created inside empty git repositories. This is done by checking if the file list only includes .git. The main reasoning for this pr is to allow the command to be easily used on new repositories that were created on GitHub for example. If the empty git repository is detected, a .gitignore is also created for convivence.
Note: The error can actually be by bypassed by adding a file named .git. However, I am not sure if logic checking for ...
We should just use the isFolderEmpty helper from the create-next-app package.
We'd need to ensure their license is included in the file
We should just use the
isFolderEmptyhelper from the create-next-app package.We'd need to ensure their license is included in the file
I've implemented your requested change; however, I wasn't really sure how to go about adding a .gitignore. Should we include a .gitignore for each template instead? Or just avoid creating one altogether.
I think we can just include a .gitignore in each template
I think we can just include a .gitignore in each template
I added https://github.com/github/gitignore/blob/main/Node.gitignore to each template, bun init actually includes a .gitignore but it seems to just be a simplified version of the node one.
As is, this comment will not be included in dist/index.js. The question is, should it? Seemingly, changing the start of this comment to /*! seems to make it be included at the bottom of the minified bundle
cc @iCrawl @ckohen
Summary
Implements the Bun templates for create-discord-bot, addressing issue #11346.
This PR adds complete TypeScript and JavaScript templates for Bun that mirror the existing Node.js templates with Bun-specific optimizations:
Key Changes
- Bun.env instead of
process.envfor environment variables (idiomatic Bun) - Bun.Glob for file pattern matching (better performance than
node:fs/promisesglob) - oven.bun-vscode added to recommended VS Code extensions
- **npm.pa...
Response to CodeRabbit Review Comments
Thank you for the thorough review! I've analyzed all 14 suggestions and want to address them:
Maintaining Consistency with Existing Templates
The Bun templates in this PR intentionally mirror the patterns used in the existing Node.js templates in this same monorepo. This ensures:
- Consistent behavior across all runtime options
- Easier maintenance (same patterns = same fixes)
- Familiar structure for users switching between runtimes
...
--env-file isn't required for Bun as it is detected by default.^1 Whether we want to be explicit about that is not a blocker from me.
Good to know. I think it would be better to be explicit since that way it will [likely] throw an error if the .env file is missing