seems to have been a client id error I made.
#Legacy guide
1 messages · Page 2 of 1
Please describe the changes this PR makes and why it should be merged:
this is a fix on the code
Describe the bug
here are the inconstancies between "changes-in-v14" and the real things that have been broken:
-
String intents no longer work, such as 'GUILD_MESSAGES', => GatewayIntentBits.GuildMessages,
-
Same for partials: 'CHANNEL' => Partials.Channel
-
no replacement for 'DIRECT_MESSAGES' is shown in the GatewayIntents section. Would be helpful.
nothing => GatewayIntentBits.DirectMessages
"Common Button Data changes" looks like it applies to button objects only ...
- String intents no longer work, such as 'GUILD_MESSAGES', => GatewayIntentBits.GuildMessages,
- Same for partials: 'CHANNEL' => Partials.Channel
- Checking permissions with .has("perm") now also needs the enums: guild.members.me.permissions.has("SEND_MESSAGES") => guild.members.me.permissions.has(PermissionsBitField.SEND_MESSAGES)
These are already listed (as well as examples given) here:
I suppose
Any areas that used to accept a string or number type for an enum parameter
Could be taken to mean that these things are broken but previously they were not enums they were "just strings".
With retrospect I can see how it is implied that the inputs have changed, now that you point it out, but before it I could not determine that this was something that was going to break. Examples would have helped a lot not only in solving the breakage but primarily in determining that ...
Anyway thanks for the swift reply c:
Hello, I am getting an error:
client.commands = new Collection();
^
TypeError: Cannot set properties of undefined (setting 'commands')
at Object. (C:\Users\David\OneDrive\Documents\Code\JavaScript\Discord Js\HomeworkHelperBot\index.js:10:17)
at Module._compile (node:internal/modules/cjs/loader:1246:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
at Module.load (node:internal/modules/cjs/loader:1103:32)
...
const { client } = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates],
});
You're attempting to destructure a client property from a Client. This is undefined.
The issue tracker is only for bug reports and enhancement suggestions. If you have a question, please ask it in the Discord server instead of opening an issue – you will get redirected there anyway.
const { client } = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates],
});
You're attempting to destructure a client property from a Client. This is undefined.
const { client } = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates], });You're attempting to destructure a
clientproperty from a Client. This is undefined.
Ok, thank you. My mistake, I'll use the discord server for future issues.
@almostSouji it is ready to review.
Seeing as you haven't noticed, I'll tell you: you pushed an empty commit. Nothing changed.
Seeing as you haven't noticed, I'll tell you: you pushed an empty commit. Nothing changed.

But I have removed the extra empty line a while ago.
Still not resolved (very visually confusing that you are using my discord avatar on GitHub, btw)
But I have removed the extra empty line a while ago.
Somehow during your commit, the line is being added back. That can be a result of your IDE auto-fixing via Prettier, for example.
But I have removed the extra empty line a while ago.
Somehow during your commit, the line is being added back. That can be a result of your IDE auto-fixing via Prettier, for example.
Well, you can see the verified signature on the commits, I tried to remove it but it still gets added back to there lol
Github makes it, not me. I also "Allow edit by maintainers", so you guys can also test it out too.
Just make to sure, made this change on main branch without touching on last...
Still not resolved (very visually confusing that you are using my discord avatar on GitHub, btw)
Somehow, Github ends up adding an extra line to the commit. I don't know why. (Oh that snake guy?)
When I try to define channel I get this error. I right clicked the channel and clicked "copy id" so it should be correct. I'm using fetch since it isn't in the cache as indicated by console.logging client.channels
An button interaction was created
ChannelManager {}
node:events:490
throw er; // Unhandled 'error' event
^
Error: Expected token to be set for this request, but none was present
const { Events, Client, GatewayIntentBits } = require('discord...
You are supposed to use the interaction.client and not make another client object as they are not linked and is basically another entity
You are supposed to use the interaction.client and not make another client object as they are not linked and is basically another entity
Is your feature request related to a problem? Please describe.
While I'm aware that you can find the limits for things under their relevant sections on either the DJS Guide, DJS Docs, or Discord's Dev site, but having to search up specific things to view the limits you have to maintain can get very tedious.
Describe the solution you'd like
It would be extremely helpful if there was a section within the DJS Guide site that simply lists all of the limits users/bots have to abide by s...
all of these limits (and more) are already listed on discord developer docs. it would be a hassle to maintain all of these limits changing.
We decided to not document upstream (read: discord API) limits within our guide or docs, as they can and historically have changed. Discord can (and evidently does) change these without prior warning or notice.
This adds a small line about a a simple way to wait for the modal to be submitted. It shows any easy way of doing this without needing to declare a client and have complex code.
for every file maybe use unix timestamps
- it looks cool
- date after converting to string looks like
Mon Feb 20 2023 15:38:11 GMT+0100 (Central European Standard Time)
yeah but it's just an example
they're free to change the code however they want
the old link to "the previous page" went to https://discordjs.guide/slash-commands/creating-commands.html
that page does not exist (anymore).
This is the closest page that would make sense imo
how ever your pr name should match the format
fix(Deleting commands): Update expired link or smth
Please describe the changes this PR makes and why it should be merged:
Adding 14.8.0 changes.
const kickedUser = await client.users.fetch(targetId);
const user = await client.users.fetch(executorId);
const user = await client.users.fetch(executorId);
console.log(`${kickedUser.tag} was kicked by ${user.tag}.`);
This page assumes you use the same file structure as our [Creating slash commands](/creating-your-bot/slash-commands.html) section, and the provided are made to function with that setup. Please carefully read that section first so that you can understand the methods used in this section.
The fact that the client commands still needs to be kept at the index.js scope is slightly confusing for newer developers when looking at the sample code on github; since the sample for the event handling tutorial does not include the client.commands collection instantiation or population, there is an implication that the logic to loop through all the command files and populate the client commands collection is to be moved elsewhere like the rest of the command handling logic that was moved i...
We can look at reviewing this, but tutorial code and samples is meant to teach concepts. If it's being blindly copy pasted, I don't believe that's our fault.
a2576e3 fix(context-menus): documentation links (#1408) - Squiddleton
28a9b3e chore(deps): bump json5 from 1.0.1 to 1.0.2 (#1... - dependabot[bot]
9b6ee2e chore(deps): bump minimatch from 3.0.4 to 3.1.2 - dependabot[bot]
Bumps minimatch from 3.0.4 to 3.1.2.
Commits
699c459 3.1.2
2f2b5ff fix: trim pattern
25d7c0d 3.1.1
55dda29 fix: treat nocase:true as always having magic
5e1fb8d 3.1.0
f8145c5 Add 'allowWindowsEscape' option
570e8b1 add publishConfig for v3 publishes
5b7cd33 3.0.6
20b4b56 [fix] revert all breaking syntax changes
2ff0388 document, expose, and test 'partial:true' option
Additional commits viewable in compare view
[: bump minimatch from 3.0.4 to 3.1.2... - dependabot[bot]
3c8e250 chore(deps): bump loader-utils from 1.4.0 to 1.... - dependabot[bot]
d76602d feat(sweepers): bot sweep example (#1348) - FabienBounoir
9c1c243 feat(autocomplete): get code in line with expla... - JoeDailey
5084d0b feat(commands): use path module for reading com... - Caladan08
a27f1fc fix(commands): permissions are checked together - almostSouji
df06c13 fix(commands): add missing command files in exp... - Axcelaw
Please describe the changes this PR makes and why it should be merged:
- Closes #1403
- Closes #1404
0a9c536 refactor(*): move emojis to jsDelivr (#1422) - Jiralite
4920a54 feat(commands): improve explanation of config v... - madCakes
would it be feasible to add the version it was introduced in in the updating section changes? (as of xx.yy.zz) / (xx.yy.zz or higher) or sth like that?
I was thinking along the lines of actually omitting that. This page is written primarily for users who are in the process of switching from version 13 to version 14, and they don't need to concern themselves with what version they're installing (because it would of course be the lastest 14.x).
(because it would of course be the lastest 14.x).
Unless they follow some outdated tutorial that pins the version, but we cannot avoid that.
Agreed, keep it as it is
May you mention that GuildModeration intent is needed to use it?
console.log(`A message by ${target.tag} was deleted by ${user.tag}.`);
target actually is an user
https://github.com/discordjs/discord.js/blob/main/packages/discord.js/src/structures/GuildAuditLogsEntry.js#L309
Please describe the changes this PR makes and why it should be merged:
After #1337 the command handler has more lines to highlight.
nitpicks and wording improvements
This will return the first entry where an invite was created. You used `limit: 1` here to specify only one entry.
Keep in mind that these examples explore a straightforward case and are by no means exhaustive. Their purpose is to teach you how audit logs work, and expansion of these examples is likely needed to suit your specific use case.
could link promise/collection to the relevant sections
// The message object is in the cache and you can provide a detailed log here.
// Ensure the executor is cached.
f2eca5e feat(*): Update guide to discord.js 14.8.0 (#1420) - Jiralite
[discordjs/guide] New branch created: 14\.8\.0
9ead6e5 Revert "feat(*): Update guide to discord.js 14.... - Jiralite
9ead6e5 Revert "feat(*): Update guide to discord.js 14.... - Jiralite
9ead6e5 Revert "feat(*): Update guide to discord.js 14.... - Jiralite
b86a177 Revert "Revert "feat(*): Update guide to discor... - Jiralite
Please describe the changes this PR makes and why it should be merged:
The real 14.8.0 update.
Please describe the changes this PR makes and why it should be merged:
Closes #1342.
I've copy pasted this from the old v12 guide and tried to adapt it for interactions.
In your main file, initialize a [Collection](/additional-info//collections.md) to store cooldowns of commands
There should be new lines before and after the ifs and try...catch. The highlights seem to be incorrect also.
Spam is something you generally want to avoid, especially if one of your commands requires calls to other APIs or takes a bit of time to build/send.
const { SlashCommandBuilder } = require('discord.js');
I believe this is correct:
2. `timestamps`: A reference to the Collection of user ids and timestamp key/value pairs for the triggered command.
I don't believe this is up-to-date. Can you please check these changes?
69ec143 fix(changes-in-v14): use Diagnostics Channel - Jiralite
[discordjs/guide] New branch created: feat/diagnostics\-channel
Please describe the changes this PR makes and why it should be merged:
Client#rest had no request event. Instead, Diagnostic Channels should be used.
console.log(request.headers); // Log the headers
import diagnosticsChannel from 'node:diagnostics_channel';
019151b chore: apply suggested changes - Jiralite
3839b1d feat: add TypeScript note - Jiralite
You can find further examples at the Undici Diagnostics Channel documentation link above.
discord.js now uses [Undici](https://github.com/nodejs/undici) as the underlying request handler. Thus, the way you can monitor API requests has changed. You must now use a [Diagnostics Channel](https://undici.nodejs.org/#/docs/api/DiagnosticsChannel). Here is a simple example:
753a511 refactor(vue): point docs links to specific ver... - almostSouji
Not a fan of the unstructured explanation here. I think this would be much more straightforward to read, if each method had its own section with the respective changes and where to find it, rather than "the other..", "in addition", and "as for".
Discord.js now uses [Undici](https://github.com/nodejs/undici) as the underlying request handler. Thus, the way you can monitor API requests has changed. You must now use a [Diagnostics Channel](https://undici.nodejs.org/#/docs/api/DiagnosticsChannel). Here is a simple example:
still capital at the beginning of a sentence
0e7707f refactor: create subheadings in REST events - Jiralite
b3ee2b9 refactor: make it clear this event is gone - Jiralite
In your main file, initialize a [Collection](/additional-info/collections.md) to store cooldowns of commands
Still its not time left
because its just unix timestamp
## Resulting code
<ResultingCode path="additional-features/reloading-commands" />
1c9e2f8 fix(autocomplete): use event enum instead of st... - Jiralite
It’s the (absolute) timestamp of when the cooldown expires, not a relative duration. So expirationTimestamp would be more appropriate here
Do we want to use ?? here in case a cooldown of 0 is set?
```js {4-9}
module.exports = {
// ...
async execute(interaction) {
const commandName = interaction.options.getString('command', true).toLowerCase();
const command = interaction.client.commands.get(commandName);
if (!command) {
return interaction.reply(`There is no command with name \`${commandName}\`!`);
}
},
};
const expirationTime = timestamps.get(interaction.user.id) + cooldownAmount;
Does not appear to be hyphenated: https://en.wiktionary.org/wiki/subfolder
After moving your commands into subfolders, it will look something like this:
in the v12 guide it uses ||
Version 12 didn't support ??, so yeah, that's why. I think it should change here.
This is an attempt to address some common errors seen in support from people who are following the guide (or not following it fully as the case usually is).
This adds an identical tip box to each of the slash command pages that need to be completed in conjunction with each other before the commands will be fully functional (write the commands + load/handle the commands + deploy the commands). People often miss one or more of these steps.
This also makes some changes to the event handlin...
This is no longer used as the event handler has come into play.
const { Client, Collection, GatewayIntentBits } = require('discord.js');
In most cases, you can access your `client` instance in other files by obtaining it from one of the other discord.js structures, e.g. `interaction.client` in the `interactionCreate` event. It doesn't need to be manually passed to your events.
Shouldn't this be a colon, with "files" at the end omitted?
Create an `events` folder in the same directory. You can then move the code from your event listeners in `index.js` to separate files: `events/ready.js` and `events/interactionCreate.js`.
This is no longer used as the event handler has come into play.
const { Client, Collection, GatewayIntentBits } = require('discord.js');
This is no longer used as the event handler has come into play.
const { Client, Collection, GatewayIntentBits } = require('discord.js');
The first picture is a screenshot of a code snippet, which shows a lambda without the async keyword.
The second shows the modified code snippet, but the change of the async keyword is not highlighted:
Fix a little typo in context menus page.
Describe the bug
When switching to either the blue or green theme on the guide the scrollbar does not change colors until the page is reloaded. See video for more context
To Reproduce
- Go to any page of the guide
- Click the "settings" dropdown on the left
- Select the theme that you're not currently on
- See scrollbar on the right (incorrect ...
I've been struggling on this part for a few minutes.
I don't know why, but the "interaction. -" wasn't recognized.
I just erased it, tested it, and it's working just fine without.
not sure if it's supposed to tho.
Bumps webpack from 5.51.1 to 5.76.1.
Release notes
Sourced from webpack's releases.
v5.76.1
Fixed
Added assert/strict built-in to NodeTargetPlugin
Revert
Improve performance of hashRegExp lookup by @ryanwilsonperkin in webpack/webpack#16759
v5.76.0
Bugfixes
Avoid cross-realm object access by @Jack-Works in webpack/webpack#16500
Improve hash performance via conditional initialization by @lvivski in webpack/webpack#16491
Serialize generatedCode in...
696dd8e chore(deps): bump webpack from 5.51.1 to 5.76.1 - dependabot[bot]
[discordjs/guide] New branch created: dependabot/npm\_and\_yarn/webpack\-5\.76\.1
Describe the bug
Trying to follow the code samples on the discordjs.guide website is semi-simple, but it's very easy to lose track of where something should go. So after checking the repo you'll notice that many things are in different places or completely missing from the repo. And this isn't super complicated stuff its a lot of stuff in the first few chapters, especially the command handler and event handler parts. And in the event handler repo there is no mention of anything command h...
[discordjs/guide] New comment on issue #1432: Code samples outdated/missing from guide documentation
I don't know what exactly the issue is you are reporting, could you elaborate?
We highlight lines in code blocks that are added or changed; accordingly,
client.commands = new Collection();
refers to the file you have built so far (with the imports on top) and the client initialization.
The highlighted parts are added below.
[discordjs/guide] New comment on issue #1432: Code samples outdated/missing from guide documentation
I don't know what exactly the issue is you are reporting, could you elaborate? We highlight lines in code blocks that are added or changed; accordingly,
client.commands = new Collection();refers to the file you have built so far (with the imports on top) and the client initialization. The highlighted parts are added below.
Yes but at the end of doing this isn't the GitHub a review of everything I've done so far? But its missing important things from the dis...
[discordjs/guide] New comment on issue #1432: Code samples outdated/missing from guide documentation
like for example where is this in the GitHub?
`client.commands = new Collection();
const commandsPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
// Set a new item in the Collection with the key as the command name and the value as the exported module
if ('data' in command && 'exec...
[discordjs/guide] New comment on issue #1432: Code samples outdated/missing from guide documentation
I see! Yes, this seems to have been missed in (the quite large) #1281, where that check was introduced.
[discordjs/guide] New comment on issue #1432: Code samples outdated/missing from guide documentation
I see! Yes, this seems to have been missed in (the quite large) #1281, where that check was introduced.
Thanks so much, thought I was crazy for a bit. If there's anything else missing can I put it in this thread?
[discordjs/guide] New comment on issue #1432: Code samples outdated/missing from guide documentation
#1427 is fixing similar stuff so I'll address it there if it isn't already.
[discordjs/guide] New comment on issue #1432: Code samples outdated/missing from guide documentation
My main
#1427 is fixing similar stuff so I'll address it there if it isn't already.
my main question is why the event handler doesn't contain the command handler code. Is that normal? and if not will that be fixed?
[discordjs/guide] New comment on issue #1432: Code samples outdated/missing from guide documentation
<img width="1054" alt="Screenshot 2023-03-15 at 8 50 52 AM" src="https://user-images.githubusercontent.com/127934454/225366102-0f77e5e1-98a9-437f-8fad-4829cf56419a.png">
<img width="529" alt="Screenshot 2023-03-15 at 8 51 06 AM" src="https://user-images.githubusercontent.com/127934454/225366134-92ce951f-3311-47aa-962f-d349fc030091.png">
<img width="262" alt="Screenshot 2023-03-15 at 8 53 02 AM" src="https://user-images.githubusercontent.com/127934454/225366304-2273f528-355e-42c0-a343-...
[discordjs/guide] New comment on issue #1432: Code samples outdated/missing from guide documentation
Yes, that is being fixed by that PR. I even say that in the description :)
Do this in your index.js above eventsPath = ....
client.commands = new Collection();
const commandsPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
client.commands.set(command.data.name, command);
}
Well, that's interesting. For what it's worth, I'm unable to reproduce this on Safari 16.3 and Firefox 111.0. I'm able to reproduce this issue on Google Chrome 110.0.5481.177, though. Possibly a Chromium issue?
I wasn't able to reproduce on safari either. The only thing I could find that was even remotely related to this was this stackoverflow post also regarding colors not changing on chrome. Which might be useful?
I click a link included in an Gmail's email and I get something wrong (no background). I then refresh the page and the background is colored completely.
After posting that, I tried it on Opera. Which has the same issue and also runs on Chromium. So this is very likely to be a Chromium issue.
[discordjs/guide] New comment on issue #1432: Code samples outdated/missing from guide documentation
Yes, that is being "fixed" by that PR. I even say that in the description :)
I realised people were deleting the command handler (even though the page doesn't tell you to) so I'm adding it back to the samples.
If you need help I did everything myself yesterday and posted it to my GitHub. It should be mostly commented so if u want to just copy-paste it feel free to.
Highlighted line 3 in a code section.
Going through this guide without importing Collection will result in the error "'Collection' is not defined."
Please describe the changes this PR makes and why it should be merged:
Here's how it looks before this quick and simple pull request:

Skimming through the code and typing the line additions as I went along, I failed to import Collection, resulting in an error. Just figured I'd tweak it and clarify!
error (ReferenceError: files is not defined
at Object. (C:\Users\bezer\OneDrive\Documentos\Projeto\Bot discord\index.js:12:23)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
...
There's very little we can do to help as you haven't provided the code causing the issue.
You appear to be trying to access a variable called files on line 12, which isn't defined.
0ff42fa fix(changes-in-v14): update uninstall examples - Jiralite
541d810 refactor(changes-in-v14): change builders to va... - Jiralite
27df636 fix: remove type in link text - Jiralite
fdb081d chore: update CONTRIBUTING.md - Jiralite
7897e07 feat: alter all links - Jiralite
2099f57 fix: change trailing links - Jiralite
Please describe the changes this PR makes and why it should be merged:
Links the subpackages over to the new site.
a79c775 fix(select-menus): dead links - Jiralite
7b9f128 fix(select-menus): add :Class - Jiralite
Since the `timestamps` Collection has the user's id as the key, you can use the `get()` method on it to get the value and sum it up with the `cooldownAmount` variable to get the correct expiration timestamp and further check to see if it's expired or not.
.addIntegerOption(option =>
option.setName("amount").setDescription("Number of messages to prune").setMinValue(1).setMaxValue(99)
),
async execute(interaction) {
const amount = interaction.options.getInteger('amount');
Same as before, might need to run prettier
.addIntegerOption(option =>
option.setName("amount").setDescription("Number of messages to prune").setMinValue(1).setMaxValue(99)
),
async execute(interaction) {
const amount = interaction.options.getInteger('amount');
Why not use .setMinValue() and .setMaxValue() here? This might need correct formatting though
In your main file, initialize a [Collection](/additional-info/collections.md) to store cooldowns of commands:
Since the `timestamps` Collection has the user's id as the key, you can use the `get()` method on it to get the value and sum it up with the `cooldownAmount` variable to get the correct expiration timestamp and further check to see if it's expired or not.
Doesn't really provide any information, maybe echo would be a more applicable example?
Though I'm not sure what this is trying to demonstrate in the first place; never appears in the written guide either, unless I'm missing something
The previous user check serves as a precaution in case the user leaves the guild. You can now use the `setTimeout` method, which will allow you to execute a function after a specified amount of time and remove the timeout.
If the user has already used this command in this session, get the timestamp, calculate the expiration time, and inform the user of the amount of time they need to wait before using this command again. Note the use of the `return` statement here, causing the code below this snippet to execute only if the user has not used this command in this session or the wait has already expired.
it's just for net letting the "fun" folder with only one file
Please describe the changes this PR makes and why it should be merged:
Recently merged PR #1435 added sections for discordjs.dev/docs/packages. This PR adds the util section since that was left out.
I didn't understand this command either. Renaming this to echo would be more clear and wouldn't cause further confusion
The <DocsLink path="class/Client" /> class in discord.js extends the [`EventEmitter`](https://nodejs.org/api/events.html#events_class_eventemitter) class. Therefore, the `client` object exposes the [`.on()`](https://nodejs.org/api/events.html#events_emitter_on_eventname_listener) and [`.once()`](https://nodejs.org/api/events.html#events_emitter_once_eventname_listener) methods that you can use to register event listeners. These methods take two arguments: the event name and a c...
For fully functional slash commands, you need three important pieces of code:
not liking the passive tone here
I see some irregularities across the guide, but I think we generally omit .html on internal links, or if necessary use .md https://github.com/discordjs/guide/blob/main/CONTRIBUTING.md#images-and-links
In most cases, you can access your `client` instance in other files by obtaining it from one of the other discord.js structures, e.g. `interaction.client` in the `interactionCreate` event. You do not need to manually pass it to your events.
passive -> active
Which makes me wonder why it's written as guild#me...
In this form of notation (https://discordjs.guide/additional-info/notation.html#classes) # refers to instance methods while . refers to static methods.
We do not plan to cover more flavors of databases in the guide at this time.
Feel free to respond to re-open, I cannot reproduce an issue with highlight colors on my end.
@monbrey is this covered/in scope of #1427 ?
If you find any other missing changes, please open a new issue, so we can consistently track this internally.
3d10bec fix(changes-in-v14): include inline in embed ... - Jiralite
semantic changes applied to the command need to be reflected in code and command structure
no longer the purpose of the command
should prob. just make the phrase required now that semantics changed
semantic change, "the options value is" prefix makes no sense anymore
semantic change, needs to change the description
sure, if it serves the purpose of stuffing out folders and doesn't really showcase anything
.addUserOption(option => option.setName('target').setDescription('The member to kick').setRequired(true)),
.addUserOption(option => option.setName('target').setDescription('The member to kick').setRequired(true)),
Make it required or account for it being null, possibly
@TetieWasTaken thanks for your review!
Please describe the changes this PR makes and why it should be merged:
Some commands has been deleted and I forgot to change images.
e91dadd fix(commands): update command category images (... - Idris1401
I suppose this should be in its correct case:
The <DocsLink path="class/Client" /> class in discord.js extends the [`EventEmitter`](https://nodejs.org/api/events.html#events_class_eventemitter) class. Therefore, the `Client` object exposes the [`.on()`](https://nodejs.org/api/events.html#events_emitter_on_eventname_listener) and [`.once()`](https://nodejs.org/api/events.html#events_emitter_once_eventname_listener) methods that you can use to register event listeners. These m...
Is your feature request related to a problem? Please describe.
Frustrated how no clear or set guides about mongodb
Describe the solution you'd like
I would love to see a clear concise guide about connecting and where and what to add to your discord bot and how to properly use mongoose package and so on.
Describe alternatives you've considered
No response
Additional notes
No response
Duplicate of #1381
We do not plan to cover more flavors of databases in the guide at this time.
Added more details on how to use localizations correctly in order to make it work.
Please describe the changes this PR makes and why it should be merged:
This is not true; you generally do not need to quote object keys in JS, unless they do not fulfill the naming requirements for literals.
In JSON however, object keys need to be quoted.
Here, we define the keys within a JS context.
Is your feature request related to a problem? Please describe.
is introduced before the deploy script. the deploy script does not respect the subfolder approach introduced before.
Describe the solution you'd like
note/comment that mentions the relevant approach/code
Describe alternatives you've considered
No response
Additional notes
No response
Please describe the changes this PR makes and why it should be merged:
We should keep the default version set by the lib instead of setting it by ourselves.
Also, when upgrading to a major version, people often don't update the version too.
601dad8 fix(faq): fix doc link for base interaction - Jiralite
d45256e fix(reactions): fix typo in emoji URL - Jiralite
27ddef6 chore(deps): bump webpack from 5.51.1 to 5.76.1... - dependabot[bot]
ac38e2c feat(command-handling: highlight collection add... - Treeway7
0ff42fa fix(changes-in-v14): update uninstall examples - Jiralite
Please describe the changes this PR makes and why it should be merged:
Updates the guide to 14.9.0.
Please describe the changes this PR makes and why it should be merged:
PR adds next as section following commit 8d345a0
See: next package
Shouldn't add the /next package—that's not for this iteration of the guide (we will very likely never reference anything to a newer version of discord.js!)
Ah alright, I thought the next package would have more added later—kinda missed the purpose then.
Describe the bug
In order to register slash commands as shown in the example you need to properly traverse 'commands' folder structure.
The example you provide is
`const commands = [];
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for...
Begin by storing the <DocsLink path="class/InteractionResponse" /> as a variable, and calling <DocsLink path="class/InteractionResponse?scrollTo=awaitMessageComponent" type="method" /> on this instance. This method returns a Promise that resolves when any interaction passes it's filter (if one is provided), or throws if none are received before the timeout. If this happens, remove the components and notify the user.
To create an action row, use the <DocsLink section="builders" path="ActionRowBuilder:Class" /> class and the <DocsLink section="builders" path="ActionRowBuilder:Class#addComponents" type="method" /> method to add buttons or a select menu.
If you're using TypeScript, you'll need to specify the type of components your action row holds. This can be done by specifying the component builder you will add to it using a generic parameter in <DocsLink section="builders" path="ActionRowBuilder:Class" />.
If you want to prevent a button from being used, but not remove it from the message, you can disable it with the <DocsLink section="builders" path="ButtonBuilder:Class#setDisabled" type="method"/> method:
Hmm... if one is highlighting everything, is the highlight redundant?
The "width units" referred to are not fixed - the actual width of each individual button will be dynamic based on its label contents.
That's everything you need to know about building and sending buttons! From here, you can learn about the other type of message component, [select menus](/message-components/select-menus), or have your bot start listening to [component interactions](/message-components/interactions) from your buttons.
The username comes up as a mention here. Not sure that's accurate.
whoops, my bad @Jiralite . I was testing in Codespaces and accidentally clicked that. My bad!
What typedef are you referring to? InteractionResponses?
content: `Are you sure you want to ban ${target} for reason: ${reason}?`,
Changed the code to address it
Not sure I want another comma here. It disrupts the flow up to "select menus" as a secondary clause and makes it feel more like a run-on sentence.
To create your buttons, use the <DocsLink section="builders" path="ButtonBuilder:Class"/> class, defining at least the `customId`, `style` and `label`.
InteractionReplyOptions:
To send your buttons, create an action row and add the buttons as components. Then, send the row in the
componentsproperty ofInteractionReplyOptions(extendsBaseMessageOptions).
To send your select menu, create an action row and add the buttons as components. Then, send the row in th...
This one should reference our overridden method, as we're making use of providing a snowflake.
If you want to use a guild emoji within a <DocsLink path="class/ButtonBuilder"/>, you can use the <DocsLink path="class/ButtonBuilder?scrollTo=setEmoji" type="method"/> method:
Updated how the message to inform the user of the amount of time they need to wait before using the command again looks. Now it looks better with the format of the unix timestamp. Also added more clarity to add the code to the InteractionCreate event, not just anywhere in the main file.
@Joeyk710 - Helped with changes
Updated how the message to inform the user of the amount of time they need to wait before using the command again looks. Now it looks better with the format of the unix timestamp. (https://github.com/discordjs/guide/pull/1446)
Also updated ${command.name} to ${command.data.name} so it will not return undefined. This request is just to update the resulting code with the guide.
@Joeyk710 - Helped with changes
If command.name is possibly undefined, there's a lot more that needs updating.
In your interaction create event, add the following code:
looks more humanable
and you can use just one pr
The current guide uses command.data.name so I'm not sure if command.name was originally used.
As shown from the guide for reference
return interaction.reply({ content: `Please wait <t:${expiredTimestamp}:R> more second(s) before reusing the \`${command.data.name}\` command.`, ephemeral: true });
If
command.nameis possiblyundefined, there's a lot more that needs updating.
there's no name property in command.name, its inside data
I mean it does, but the event is called that, ima check what the guide has it as and go off that.
🤷 I mean I could, but I see no need to.
You should use the other pull request to update this code instead of creating multiple. I'll close this, and please commit to your other branch.
Combined other pull request
I'm not against the #name fix. But this semantic change seems unnecessary.
This semantic change seems unnecessary.
I mean it does, but the event is called that, ima check what the guide has it as and go off that.
Events.InteractionCreate returns 'interactionCreate
the event name is "interactionCreate"
however more readable is just interaction create
Wrap it in backticks or link the documentation to it just like here:
b34d374 chore: update documentation link in navbar and ... - Jiralite
The former is unacceptable—the relative timestamp would end up looking like this:
Please wait
in 30 secondsmore seconds[...]
I believe this current change is fine.
return interaction.reply({ content: `Please wait, you are on a cooldown for \`${command.data.name}\`. You can use it again <t:${expiredTimestamp}:R>`, ephemeral: true });
return interaction.reply({ content: `Please wait, you are on a cooldown for \`${command.data.name}\`. You can use it again <t:${expiredTimestamp}:R>.`, ephemeral: true });
307e245 fix(cooldowns): command#data#name and relative ... - AmNobCop
53e3b3b refactor(commands): do not specify the version ... - Idris1401
Fixes an issue where the scrollbar doesn't repaint to match theme on certain browsers until hovered over.
Does this resolve #1430?
Please describe the changes this PR makes and why it should be merged:
Mostly semantic changes. But also a change which I was not too sure about.
On this line (and 1 similar one later)
keepOverLimit: (member) => member.id === client.user.id
I'd change it to
keepOverLimit: (member) => member.id === YourClientID,
I'm assuming this is the correct option since in the caching options your client isn't logged in yet (i.e client.user is undefined). But I'm not...
Sometimes, you might want to customize the caching behavior of discord.js in order to reduce memory usage.
This part was useful
this is a non-issue since sweepers get evaluated after login when client#user is present
if there are some typos, but semantic changes are not necessary or improve reading flow.
Is your feature request related to a problem? Please describe.
I spent a good 10 minutes trying to figure out why my node index.js prompt keeps returning an error
Until I thought it was something to do with not being logged onto discord and having no server connection. And now it works.
Describe the solution you'd like
Can you just add a little line that says: "Make sure you are logged on to discord, otherwise it will not function."
This is just something to help other newbie...
the application owner doesn't need to be online to put his bot online
Hm, that is true I have just tested it, but why did it not work before?
actually you didn't even send the error you've got before
Hello, I'm writing this to request a change in command-deployment guide of djs. I had legacy chat options enabled and that was stopping interactions from being accessible on my client which lead me to wonder for about 3 hours what could be the cause of this. I simply request a small note or a reminder for the guide that users need to uncheck that option in their settings in order to be able to use integrations properly. Majority of the searches on google lead to the same "the application prob...
Hi, is there any way to get all messages white user and avatar in thread by id?
ec59cb6 feat: further improvements to the Creating your... - monbrey
74f8e54 fix(vue): update main scrollbar theme on switch... - brynpttrsn
Hi! I'm going through the examples from scratch and ran into a few issues above:
foldersPathwas undefined- I moved the REST() into the async, otherwise I got
TypeError: (intermediate value).setToken(...) is not a function
I'm using Node 18.15.0 on Windows 11. After the above changes, the tutorial works again
Screenshots of deploy errors

 into the async, otherwise I got
TypeError: (intermediate value).setToken(...) is not a function
This will not make a difference.
85c7065 fix(command-deployment): folder pathing variabl... - ZoraDrip
- I moved the REST() into the async, otherwise I got
TypeError: (intermediate value).setToken(...) is not a functionThis will not make a difference.
Just to add, the reason you got this error is because you didn't have a semicolon ; on the end of the previous line.
We'll be moving to a new website and this unfortunately won't be in scope (including the documentation).
4e3ad1b fix(changes-in-v14): don't use /files in GitHub... - Jiralite
d32bdf5 fix(changes-in-v14): update MessageOptions to... - Jiralite
6fbe686 fix(changes-in-v14): remove out-of-place discor... - Jiralite
aff1fc8 fix(changes-in-v14): put changes on a new line - Jiralite
30ab79f fix(changes-in-v14): Interaction -> `BaseInte... - Jiralite
Please describe the changes this PR makes and why it should be merged:
ChannelType is not defined which results to error
Please describe the changes this PR makes and why it should be merged:
Originally, the collector acknowledged i, the interaction instance only defined in the scope of the filter function. Now, it acknowledges confirmation, the interaction instance that was actually collected.
6a79d16 fix(interactions): reference awaited interactio... - Squiddleton
Please describe the changes this PR makes and why it should be merged:
It has outdated information toast.
I feel like the whole tip should be removed. There's no implication above this in the guide that archived threads cannot be locked, so there's no reason to doubt this?
I feel like the whole tip should be removed. There's no implication above this in the guide that archived threads cannot be locked, so there's no reason to doubt this?
Well, you are right. I changed it to info toaster cause there’s old developers would notice it that it has been updated on Discord API. But sure, do you want I remove it?
Yeah, please remove it.
[discordjs/guide] New branch created: 14\.10\.0
Please describe the changes this PR makes and why it should be merged:
Updates the guide to 14.10.0.
Feel free to make a pull request to this branch or note changes in the comments.
Please describe the changes this PR makes and why it should be merged:
I think it's better to name the filter variable differently than the filter option because people are often thinking that they could name the variable however they want and pass it as a key in the method.
yeah should but don't need collectorFilter right? as filter isn't defined
Yeah, it's just meant for showing the difference for componentType.
I can't believe this has been avoided/delayed for so long - first class typescript support should be the standard now. Especially to avoid things like this:
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(
`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`
);
}
There's nothing wrong with this, nor should it be avoided in JavaScript code.
We are also going to support TypeScript though
@monbrey I'm saying that JavaScript code should be avoided, by pushing TS as the primary/recommended way of doing things in the docs. That way nobody needs to worry about checking for key names on arbitrary objects.
I get that it can be seen as personal preference, but ultimately the docs should be recommending best practices and type safety, and giving the option for JS. Not the other way around.
JS is a valid programming language, and often the default for beginners. It is not easy to wrap your head around types when you are starting out, which a large portion of our user base is.
Thank you for your concern, but we will stick to JS as a main language for the guide and consider including TypeScript examples or variants where appropriate.
For the reloading commands part of the code, it failed to run if the commands were in categories as suggested previously by the guide thus the code couldn't get the commands through require. I added a category key to the exports object and appropriate code in the reload.js file to properly.
fix the lint issues and after that it should be good imo
6f7ac15 fix(reloading-commands): add categories to code... - nanashi-03
6831fa1 feat(changes-in-v14): document all image URL op... - Jiralite
Please describe the changes this PR makes and why it should be merged:
I believe at this point in the guide, it would probably be best to reference the advance creation page, meaning they have read everything up to that point. It's also consistent with the context menus page (after this).
This page is a follow-up to the [interactions (slash commands) page](/slash-commands/advanced-creation.md). Please carefully read that section first, so that you can understand the methods used in this section.
Please describe the changes this PR makes and why it should be merged:
there's a mistake
In the guide for cooldown it tells you to place the code in InteractionCreate with the assumption you followed the Command Handling portion.
When you do this it gives an error that client is not defined due to this line
const { cooldowns } = client;
When you look at the repository the code provided is in the index.js file and not in the interactionCreate file that was created during command handling portion.
The question i have is what is the equivalent items for client in the int...
You just didnt define it
Guide shows this part: https://discordjs.guide/additional-features/cooldowns.html#cooldowns
I have client.cooldowns = new Collection(); in my index.js
I also put it in my interactionCreate file after your reply and still get that client is not defined.
When i look at the github repo it only shows this code in the index file. if i take what is there an place it in the index file it works no issue but i am wanting the code in the event file that was created.
I have client.cooldowns = new Collection(); in my index.js
I also put it in my interactionCreate file after your reply and still get that client is not defined.
When i look at the github repo it only shows this code in the index file. if i take what is there an place it in the index file it works no issue but i am wanting the code in the event file that was created.
I have it figured out. when in the interactionCreate.js file ,that was created during the Command Handling portion of the guide, you need to have client changed to interaction.client.
The git hub needs to be updated to reflect correctly. the link does not provide the interactionCreate.js file at all.
https://github.com/discordjs/guide/tree/main/code-samples/additional-features/cooldowns
Below is what the interactionCreate.js should look like after implementing the cooldown funct...
I have it figured out. when in the interactionCreate.js file ,that was created during the Command Handling portion of the guide, you need to have client changed to interaction.client.
The git hub needs to be updated to reflect correctly. the link does not provide the interactionCreate.js file at all.
https://github.com/discordjs/guide/tree/main/code-samples/additional-features/cooldowns
Below is ...
[discordjs/guide] Issue opened: #1464 When I say "npm run dev" and enter, the server does not open\.
Describe the bug
in Contributing
The local development part does not work, the files are downloaded to your computer, but lastly, it does not work when I say npm run dev
To Reproduce
1.) git clone https://github.com/discordjs/guide.git
2.) cd guide
3.) npm install
4.) npm run dev
See error
Screenshots
Device (please complete the following information)
device: windows...
I found that on Windows I needed to downgrade the vite dependency to 2.5.0 in order to get this version of the guide to run.
Having said that, since the guide has been rebuilt on React and we're in the process of porting across content, it unlikely this is going to be fixed.
Is your feature request related to a problem? Please describe.
The reloading commands guide gives a good code snippet to effectively reload commands if they are all on the same file level, however it doesn't work if commands are nested in subfolders.
[To build the correct file path, you will need the file name. You can use command.data.name for doing that.](https://discordjs.guide/additional-feat...
Is your feature request related to a problem? Please describe.
If a user has a different/wrong time, it can cause an error in the cooldown since Date.now() retrieves the current timestamp from the computer where the bot is running, not from the user executing it, resulting in a potential variation in the cooldown.
Describe the solution you'd like
Using interaction.createdTimestamp can solve the problem and would be more informative for the guide, especially if someone tries the cod...
Part of the guide or code sample the question is about
My Error :
Error executing ping
DiscordAPIError[10062]: Unknown interaction
at handleErrors (E:\Programming\programmingFiles\nodejs\doersbot\node_modules@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (E:\Programming\programmingFiles\nodejs\doersbot\node_modules@discordjs\rest\dist\index.js:736:23)
at async ...
Part of the guide or code sample the question is about
My Error :
Error executing ping
DiscordAPIError[10062]: Unknown interaction
at handleErrors (E:\Programming\programmingFiles\nodejs\doersbot\node_modules@discordjs\rest\dist\index.js:640:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async BurstHandler.runRequest (E:\Programming\programmingFiles\nodejs\doersbot\node_modules@discordjs\rest\dist\index.js:736:23)
at async ...
Please describe the changes this PR makes and why it should be merged:
The filter for the cache sweeper example should be a function that returns another function, according to the library's typings. This fixes the current example which was only a function that directly returns a boolean.
[discordjs/guide] New comment on pull request #1469: fix\(cache\-customization\): fix sweeper filter
it is not?
The current typing is:
type GlobalSweepFilter<K, V> = () => ((value: V, key: K, collection: Collection<K, V>) => boolean) | null;
As you can see, it can be either a function that returns null or a function that returns another function, the latter of which returns a boolean.
[discordjs/guide] New comment on pull request #1470: fix\(cooldowns\): delete expired cooldown reply
Um it isn't a good idea
as even reserving bot won't delete it
also 10 minutes ago shows that end of the timeout was in the past
/reload command ping
guide:
Error executing reload
Error: Cannot find module './ping.js'
Require stack:
- ……\commands\utility\reload.js
code-samples:
Error executing reload
Error: Cannot find module '../undefined/ping.js'
Require stack:
- ……\commands\utility\reload.js
/reload command ping
guide:
Error executing reload
Error: Cannot find module './ping.js'
Require stack:
- ……\commands\utility\reload.js
code-samples:
Error executing reload
Error: Cannot find module '../undefined/ping.js'
Require stack:
- ……\commands\utility\reload.js
If command has category property right set, it should work
It's probably that you haven't registered the commands properly with the Discord API or that you haven't handled them properly in the interactionCreate event. Can't tell without more information.
@masih-js I ran into this error because I included discord in my bot name. It would propagate when I called interaction.reply. Make sure that the bot you are writing doesn't include discord anywhere in the name. Not in your app name, or your bot name. Hope that helps!
Hello
Thanks for helping me , actually I found the problem. It was from my network connection.
Hello
Thanks for helping me , actually I found the problem. It was from my network connection.
Hello
actually I found the problem. It was from my network connection.
Hello
actually I found the problem. It was from my network connection.
Describe the bug
The bug is related to a discrepancy between the information provided in the guide and the actual file structure in the GitHub repository. The guide (https://discordjs.guide/creating-your-bot/slash-commands.html#individual-command-files) states that the command file should be located at "commands/user.js", but in the GitHub repository, it is actually located at "commands/utility/users.js". This inconsistency can cause confusion for users trying to follow the guide and loc...
Seems like it might be linking to the wrong part, or has been subfoldered too early. The next section of the guide has you sort your commands into categories: https://discordjs.guide/creating-your-bot/command-handling.html#command-categories
Describe the bug
In the guide, I'm instructed to create an interactionCreate.js file for the event listeners, but in the repo, additional-features doesn't have an interactionCreate.js file.
Instead, in the repo, additional-features has cooldown code in index.js, making it harder to check code.
This is an issue because while I'm pretty sure I put the code in the right place, I can't say for certain and I have no reference to go by due to the missing interactionCreate.js file in the ...
Changed console output on error fetching webhooks from a particular channel.
Just a small change to prevent 404, I updated 2 links from /interactions to /message-components.
fixed a typo on the .setRequired() method.
This closes addStringOption( from above
Not sure if you still need help but you can define Client in the InteractionCreate.js file. But there might be a better way than what I did, I am not really good at coding, just know a little bit about it.
About the const {cooldowns} = client; the guide told you to add it in the InteractionCreate Event (in the index.js) and not in the InteractionCreate.js file because it did not use the InteractionCreate.js. I just added the first 3 lines in the attached image to the InteractionCreate.js an...
Just aesthetic changes such as ::: and inconsistent markdown/html
can you elaborate on the purpose of this update? we deliberately use tips and discord messages here.
54bc111 chore(deps): bump vite from 2.9.15 to 2.9.16 - dependabot[bot]
Bumps vite from 2.9.15 to 2.9.16.
Changelog
Sourced from vite's changelog.
2.9.16 (2023-05-26)
fix: port #13348 to v2, fs.deny with leading double slash (#13350) (7d8100a), closes #13348 #13350
Commits
ea814d7 release: v2.9.16
7d8100a fix: port #13348 to v2, fs.deny with leading double slash (#13350)
See full diff in compare view
[[https://discord.gg/djs).
@megatank58 thanks, I'll do that. Do you have any advice on how to log more detailed error messages because all I see in Discord is "The application did not respond"?
f1f923d chore(deps): bump vite from 2.9.15 to 2.9.16 (#... - dependabot[bot]
b5c6f85 fix(*): Update message component links to no lo... - aMySour
Not sure if you still need help but you can define Client in the InteractionCreate.js file. But there might be a better way than what I did, I am not really good at coding, just know a little bit about it. About the const {cooldowns} = client; the guide told you to add it in the InteractionCreate Event (in the index.js) and not in the InteractionCreate.js file because it did not use the InteractionCreate.js. I just added the first 3 lines in the attached image to the InteractionCreate.js an...
Thanks for the info, just out of interest why is it wrong? for me it worked the way I did. But as I said, I am not good at coding, I just tried to find a solution for it.
Not sure if you still need help but you can define Client in the InteractionCreate.js file. But there might be a better way than what I did, I am not really good at coding, just know a little bit about it. About the const {cooldowns} = client; the guide told you to add it in the InteractionCreate Event (in the index.js) and not in the InteractionCreate.js file because it did not use the InteractionCreate.js. I just added the first 3 lines in the attached image to the InteractionCreate.js ...
Thanks for the info, just out of interest why is it wrong? for me it worked the way I did. But as I said, I am not good at coding, I just tried to find a solution for it.
you're initializing a new client instead of getting the client instantiated this interaction
Window "pane" is technically not incorrect to use here and this isn't really a typo. But I agree that in context "panel" is probably easier to understand and translate
Create a guide for seeking audio resources.
Please describe the changes this PR makes and why it should be merged:
Explain how to seek audio resources with raw discord.js and @discordjs/voice
Many questions about seeking on Discord.js guild are posted, and there's no guide about seeking. So I created this.
I found that on Windows I needed to downgrade the vite dependency to 2.5.0 in order to get this version of the guide to run.
Having said that, since the guide has been rebuilt on React and we're in the process of porting across content, it unlikely this is going to be fixed.
thank you.
Is your feature request related to a problem? Please describe.
The issue at hand is that the embed section lacks consistent code snippet references, as compared to the creating your bot section. This discrepancy in the documentation can be confusing, especially for beginners, as they encounter different code snippets within the same guide. It is essential to provide clear and consistent code examples throughout the documentation to avoid any confusion or misunderstanding for programmers....
Please describe the changes this PR makes and why it should be merged:
- The package is simply useful and easy to use. Customization options are large and simple. (it's logging library)
I don't think it is an useful package
Not much related to djs
so? none of the packages are related to djs
This portion of the guide is confusing because it does not work with a previous section title "Command Categories" which has the user move commands in to subcommand folders.
The changes I've made allow for the full commands folder to be searched for a matching command. This will work no matter the path to the file inside the command folder.
5df4925 chore(deps-dev): bump word-wrap from 1.2.3 to 1... - dependabot[bot]
Bumps word-wrap from 1.2.3 to 1.2.4.
Release notes
Sourced from word-wrap's releases.
1.2.4
What's Changed
Remove default indent by @mohd-akram in jonschlinkert/word-wrap#24
🔒fix: CVE 2023 26115 (2) by @OlafConijn in jonschlinkert/word-wrap#41
:lock: fix: CVE-2023-26115 by @aashutoshrathi in jonschlinkert/word-wrap#33
chore: publish workflow by @OlafConijn in jonschlinkert/word-wrap#42
New Contributors
@mohd-akram made their first contri...
[discordjs/guide] New branch created: dependabot/npm_and_yarn/word-wrap-1.2.4
This would require users to download the glob package using npm. As this is not stated on the page, I would recommend adding a part for installing the package.
Is your feature request related to a problem? Please describe.
Not a problem, but I dont understand how the component handling should work. Ive dug through every resource I can find and I cant find anything complete enough for me to understand.
Describe the solution you'd like
I 'd love to see how a slash command that uses the different builders, like stringselectmenubuilder, button builder, and then how the interactionCreate and a componentHandler work with the component files. ...
Hello,
I was wondering if it's possible to allow a user to select multiple choices when given a predefined list of choices using the addStringOption addChoices in the SlashCommandBuilder
It seems that with the default options from the documentation, a user can only select one choice.
It is not possible to select multiple choices. You can, however, explore different options or approaches. One would be to utilise a string select menu.
It is not possible to select multiple choices. You can, however, explore different options or approaches. One would be to utilise a string select menu.
To add to what Jira said: we can only add features Discord has, but you can always try to suggest new features and improvements at https://github.com/discord/discord-api-docs/discussions
Part of the guide or code sample the question is about
It looks like the hidden command was implemented. But I couldn't find where in class I can specify it as hidden.
Question
Commands should be able to be flagged as "hidden", preventing them from being listed in the built-in help command entirely.
This is a 5 year old PR for a discord.js framework that is no longer functional.
Discord does not support any sort of "hidden command".
I'm afraid but could you run ESLint one more time? I have fixed all of the error and warning.
discord.js does not have a built-in method for seeking audio resources.
raw discord.js seems a bit off
The function returns the seeked stream. For more configuration options you can look at the [prism media documentation](https://amishshah.github.io/prism-media/).
It might be better to explain these as text after this example
### Sample code
Might be better it name it such way as the complete code is provided at the end of the section?
Oh I think so let me fix it
umm could u explain a bit more? like prism-media? or distube or discord-player?
hm maybe this section can be completely removed as we do mention prism-media at the first section
k it seems like I've fixed all reviews you sent
so I have to wait until ESLint approval and merge
Is your feature request related to a problem? Please describe.
I want to change to User Status and Custom messages. With the given permission this should not be a problem.
Im building a bot for Businesses which changes the User status on meetings or slash commands or other activities which im handling.
Describe the solution you'd like
With this feature i believe lot's of people may have oppurtunity to came up with new ideas.
Describe alternatives you've considered
_No resp...
Im building a bot for Businesses which changes the User status
Bots can only modify their own custom status. Can you clarify what you mean?
I want my bot to change Users status. specified here.
Discord doesnt allow that
That is not possible as I've said. Also, what does this have to do with the guide?
Ows sorry i thought this is discordJS feature request. ⭕ Sorry all.
Good point. Added a line about installing glob.
You can use the glob package to navigate your slash command file structure. To install the package run `npm install glob` in the terminal.
wording and consistency https://github.com/discordjs/guide/blob/main/CONTRIBUTING.md#youyour-instead-of-weour
Please describe the changes this PR makes and why it should be merged:
This property doesn't exist in v14 and having it in the code sample that's referenced in the guide may lead to some confusion.
Wait, you're making this change to reflect the command categories page, right? So why should we use a different approach than that page? I'd say either use fs here, or also make the categories page use glob.
This also occurs in these code samples, maybe also remove it there as well?
- code-samples/additional-features/cooldowns/commands/utility/avatar.js
- [code-samples/additional-features/reloading-commands/commands/utility/avatar.js](https://github.com/discordjs/guide/blob/3ea2ef3af749dc4e80b129b56b900f9e2d6faec6/code-samples/additional-f...
I don't think changes like these are needed especially when the new guide is in the works.
Please describe the changes this PR makes and why it should be merged:
- Adds instructions for
bunpackage manager
Discord.js is fully supported in Bun: https://bun.sh/blog/bun-v0.6.7. I've put in a sister PR that adds bun to the create-discord-bot CLI: https://github.com/discordjs/discord.js/pull/9798
Discord.js is fully supported in Bun: bun.sh/blog/bun-v0.6.7
We have a page on how to get started with sharding, which will apparently not work: https://github.com/oven-sh/bun/issues/4159#issuecomment-1678647702.
I personally would also wait for https://bun.sh/1.0 too. Not sure what others think.
Oops yeah hadn't seen that. Definitely reasonable to wait for 1.0.
Worth noting that all the changes in the PR pertain to usage of bun as a package manager, not a runtime. We're seeing a lot of Node.js users use bun exclusively as a package manager/script runner.
Part of the guide or code sample the question is about
https://discordjs.guide/interactions/modals.html#building-and-responding-with-modals
Question
Hello everyone! I need some help with the documentation. It explains how to make a pop-up window (modal) appear when a user types "/ping." However, I'm wondering if it's also possible to show this pop-up when a user joins the server.
Here's what I'm trying to do: When a user joins the server, I want a pop-up to show up. Inside the p...
Part of the guide or code sample the question is about
https://discordjs.guide/interactions/modals.html#building-and-responding-with-modals
Question
Hello everyone! I need some help with the documentation. It explains how to make a pop-up window (modal) appear when a user types "/ping." However, I'm wondering if it's also possible to show this pop-up when a user joins the server.
Here's what I'm trying to do: When a user joins the server, I want a pop-up to show up. Inside the p...
A user has to do something to receive a modal (hence the term "interaction"). They have to interact with your bot in some way to receive a modal.
When a user joins a guild, you'll have to figure out a way how they can interact with your bot to receive a modal. This might be a button in a channel, for example.
Hey I'm really sorry but could you run ESLint one more time
Sorry could you re-run ESLint check
(Why ESLint says readability is unnecessary)
Thank you so much for running so many ESLint check
deferring in the filter is semantically horrible https://discordjs.guide/popular-topics/collectors.html#await-modal-submit
Part of the guide or code sample the question is about
Is distube is safe for discord verification? Does the discord bot reviewer will accept distube for verification.
Question
Is distube is safe for discord verification? Does the discord bot reviewer will accept distube for verification.
Part of the guide or code sample the question is about
Is distube is safe for discord verification? Does the discord bot reviewer will accept distube for verification.
Question
Is distube is safe for discord verification? Does the discord bot reviewer will accept distube for verification.
No. playing audio from YouTube is against their terms of service.
No. playing audio from YouTube is against their terms of service. That means it's not safe for verification
Describe the bug
Unsure what exactly is going on but when i console log the message id or interaction id before the message is sent and then when the message i sent the message id changes. Is there a reason for this and if so whats a fix for this as i need it so i can edit the message from the id when a request is made.
To Reproduce
module.exports.execute = async (client, interaction) => {
const embed = new EmbedBuilder()
.setColor(0x5FE88D)
...
you are comparing a message id to an interaction id
Describe the bug
Unsure what exactly is going on but when i console log the message id or interaction id before the message is sent and then when the message i sent the message id changes. Is there a reason for this and if so whats a fix for this as i need it so i can edit the message from the id when a request is made.
To Reproduce
module.exports.execute = async (client, interaction) => {
const embed = new EmbedBuilder()
.setColor(0x5FE88D)
...
you are comparing a message id to an interaction id
A user has to interact with your bot in some way to receive a modal (hence the term "interaction").
When a user joins a guild, you'll have to figure out a way how they can interact with your bot to receive a modal. This might be a button in a channel, for example.
No im not comparing im just logging both of them to show those ids and then when you actually copy the message id from the embed its different than both of those
I see, https://old.discordjs.dev/#/docs/discord.js/main/class/ButtonInteraction?scrollTo=deferReply returns a Message only if the fetchReply option is passed. Otherwise an InteractionResponse. So you are comparing the id of the InteractionResponse to the message, since you do not supply the fetchReply option int he deferReply call.
Oh alright, yeah didnt think i was doing it wrong since i havent touched discord.js in a while and seen it doing that and though it was a bug or something. Sorry for the confusion and all and thank you for the help.
I see, https://old.discordjs.dev/#/docs/discord.js/main/class/ButtonInteraction?scrollTo=deferReply returns a Message only if the fetchReply option is passed. Otherwise an InteractionResponse. So you are comparing the id of the InteractionResponse to the message, since you do not supply the fetchReply option int he deferReply call.
Describe the bug
The API returns invalid form body when using the Deploy placed in the guide.
To Reproduce
C:\Users\Master\Desktop\cum>node deploy.js
Started refreshing 2 application (/) commands.
DiscordAPIError[50035]: Invalid Form Body
application_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
guild_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
at handleErrors (C:\Users\Master\Desktop\cum\node_modules@discordjs\rest\dist\index.js:687:13)
...
Describe the bug
The API returns invalid form body when using the Deploy placed in the guide.
To Reproduce
C:\Users\Master\Desktop\cum>node deploy.js
Started refreshing 2 application (/) commands.
DiscordAPIError[50035]: Invalid Form Body
application_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
guild_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
at handleErrors (C:\Users\Master\Desktop\cum\node_modules@discordjs\rest\dist\index.js:687:13)
...
I suggest giving the registering command guide another read. As I can see in the error, both the application id and the guild id in the deploy URL come out as undefined .../applications/undefined/guilds/undefined/..... The guide fills those values based on a config.json file.
Part of the guide or code sample the question is about
interaction.reply({ content: ` You can use it again .`, ephemeral: true })
Question
I have a doubt, in the official guide it is shown to put `` to show the time left to use the command again, but this only makes it start counting how much time has passed since the message was sent, example '1 minute ago' instead of showing the time left to countdown, is this on purpose?
expiredTimestamp is defined based on expirationTime, which adds the cooldownAmount to the timestamp of the last use:
const expiredTimestamp = Math.round(expirationTime / 1000);
// ...
const expirationTime = timestamps.get(interaction.user.id) + cooldownAmount;
I know, this is the code that I have, what I wanted to say, is that in discord the time of the message that shows <t: :R> shows a timestamp from when the message was started, but the text implies that it should show a countdown of how much time is left to use the message, am I right or what the guide shows is wrong?
Continue to count the time elapsed, example of the bot response using the example in the guide:
Please wait, you are on a cooldown for ping. You can use it again in...
It seems to me that the only solution is that once the countdown reaches 0, before the counter starts to increase its value, delete the interaction.
if (now < expirationTime)
{
const expiredTimestamp = Math.round(expirationTime / 1000)
interaction.reply({ content: `Please wait, you are on a cooldown for \`${command.data.name}\`. You can use it again in <t:${expiredTimestamp}:R>`, ephemeral: true })
setTimeout(() => { interaction.deleteReply() }, expirationTime - now)
re...
Change "Used to applying filtering" to "Used to apply filtering"
Changes:
Added a single line that points to https://discord-api-types.dev/api/discord-api-types-v10/enum/GatewayIntentBits
This link provides the names of the available intents compared to the previous link to the discord API which did not list the discord.js names.
Purpose
The change is to provide additional, easy-to-access information for users.
The library equivalent of which are listed on the [Discord API Types](https://discord-api-types.dev/api/discord-api-types-v10/enum/GatewayIntentBits).
discord.js-specific name doesn't seem correct, perhaps something like this would be better?
also maybe there should be some indication that discord api types is a package here different from discord api docs? seems like something that's easy to confuse
I agree that the wording you provided is much better.
I originally suggested the addition just so that people would be able to find the library names without having to search too much, and this clarifies that.
Bumps postcss from 8.4.16 to 8.4.31.
Release notes
Sourced from postcss's releases.
8.4.31
Fixed \r parsing to fix CVE-2023-44270.
8.4.30
Improved source map performance (by @romainmenke).
8.4.29
Fixed Node#source.offset (by @idoros).
Fixed docs (by @coliff).
8.4.28
Fixed Root.source.end for better source map (by @romainmenke).
Fixed Result.root types when process() has no parser.
8.4.27
Fixed Container clone methods types.
8.4.26
Fixed c...
ae53ea3 chore(deps-dev): bump postcss from 8.4.16 to 8.... - dependabot[bot]
[discordjs/guide] New branch created: dependabot/npm_and_yarn/postcss-8.4.31
I have a nodeJS discord bot... Having issues.
I can't get to the bottom of this. client.on("guildBanAdd" or client.on("guildMemberRemove" do not trigger if run first after launch. If I run a slash command first, or remove a ban, or kick a user anything to get the code flowing first, it runs fine. But if I launch the bot then kick/ban someone or they leave... nada. The bot obviously has the perms and intents etc because the code runs error free, but if it's first it just doesn't even tr...
Describe the bug
Incorrect documentation, states (as of 12/10/2023) the following:
...Currently, you cannot use StringSelectMenuBuilders or ButtonBuilders in modal action rows builders-
However according to the Discord Developers Discord Guild (Thanks souji!), that nothing but text input is supported at the moment.
Attempting to add EG: a ChannelSelectMenu to the Modal does not work and returns with Invalid Form Body.
To Reproduce
Go to the [documentation](https://discor...
Please describe the changes this PR makes and why it should be merged:
Issue #1508.
You will need to enable partials
669abb9 fix(modals): update allowed components in modal... - Axodouble
Thanks for getting back to me! Can you elaborate some more please? This is new to me :)
More info can be found here https://discordjs.guide/popular-topics/partials.html#partial-structures
(Also, there's a discord server. you're more likely to get a faster answer there)
Haha thanks! I tried the discord developers server if that's what you mean. Was ignored twice :/
But thanks I'll give this a read and see if it sorts it out :)
The official djs server is .gg/djs
You will need to enable partials
Amazing. Yeah I can grab the ID from the partial and make it work from there. Thanks for the assist <3
I want to leave a log when someone enters the voice channel.
`client.on('voiceStateUpdate', async (oldState, newState) => {
const VOICE_SUPPORT_ID = '123123123';
const LOG_CHANNEL_ID = '123123123';
const USER_LEFT = !newState.channel;
const USER_JOINED = !oldState.channel;
const USER_SWITCHED = newState.channel?.id !== oldState.channel?.id;
...
Please describe the changes this PR makes and why it should be merged:
This fixes an invalid link which would take you to https://discordjs.guide/message-components/creating-your-bot/event-handling which doesn't exist, it should be https://discordjs.guide/creating-your-bot/event-handling
Part of the guide or code sample the question is about
https://discordjs.guide/creating-your-bot/event-handling.html#individual-event-files
Under the topic 'Event handling' two files need to be created i.e., ready.js & interactionCreate.js in a folder 'events'.
Question
This github repository has the interaction function in the index file.
However, as per the guide (linked above), I created two separate files.
ready.js runs fine, but as soon as I try slash command, it ...
I am facing the same issue @emkirsh (#1512).
If you have resolved the issue please let me know.
Also, @Idris1401 is right @TheKurara , initializing a new client in the interactionCreate.js file may not be the best idea as the context will change.
I tried exporting the client variable to the interactionCreate.js file but it did not work.
I am facing the same issue @emkirsh (#1512). If you have resolved the issue please let me know.
Also, @Idris1401 is right @TheKurara , initializing a new client in the interactionCreate.js file may not be the best idea as the context will change.
I tried exporting the client variable to the interactionCreate.js file but it did not work.
Have you tried what Idris said? Using interaction.client instead of client?
@sdanialraza Yes, I tried that. I think just using client instead of interaction.client works when the interaction function is in the index file.
Yes as client is defined in the index file, but otherwise, most structures have a client property, like message.client, interaction.client, etc.
I am facing the same issue @emkirsh (#1512).
If you have resolved the issue please let me know.
Also, @Idris1401 is right @TheKurara , initializing a new client in the interactionCreate.js file may not be the best idea as the context will change.
I tried exporting the client variable to the interactionCreate.js file but it did not work.
Yes I know. Idris already wrote me why it's wrong.
line 16 my man, not line 9
Oh, yes. I see @Idris1401 thanks for that. It is line 16.
@Idris1401 Thanks man. It works fine now. Till now I was under the assumption that it is line 9.
const {cooldowns} = interaction.client; along with the import statement const { Collection } = require("discord.js");
<img width="892" alt="Screenshot 2023-10-16 at 3 37 10 PM" src="https://github.com/discordjs/guide/assets/72296875/1ed044f6-afe1-4d6f-b0c0-096943023c08">
Resolves #1512
This repository doesn't have a separate interactionCreate.js file as mentioned in the guide https://discordjs.guide/creating-your-bot/event-handling.html#individual-event-files. Which is why client doesn't need a reference but using client in other / separate files would need a reference i.e. interaction.client in place of client.
- Go to the interactionCreate.js file
- when declaring cooldown in the execute function, assign `const {cooldowns} = interaction.cl...
Since this issue looks similar, please see #1512 @emkirsh
I was able to resolve the issue with some minor changes.
Please feel free to close the issue if it works.
GuildMember#displayName will go through the following hierarchy:
- Nickname, if set
- Global name, if set
- Username
The nickname of this member, or their user display name if they don't have one
See the guide section on listening for reactions on old messages. You need to enable various partials and will have caveats to deal with to achieve this, as discord.js cannot retrieve the respective structures from cache after a reboot.
GuildMember#displayName will go through the following hierarchy:
- Nickname, if set
- Global name, if set
- Username
The nickname of this member, or their user display name if they don't have one
@thegamingsoul I'll try it by the end of the week if not sooner!
Resolves #1512 & #1474 This repository doesn't have a separate interactionCreate.js file as mentioned in the guide https://discordjs.guide/creating-your-bot/event-handling.html#individual-event-files Which is why client doesn't need a reference but using client in other / separate files would need a reference i.e.
interaction.clientin place ofclient.
- Go to the interactionCreate.js file
- when declaring cooldown in the execute function, assign `const {cooldowns} = int...
Please describe the changes this PR makes and why it should be merged:
As discussed internally, just throwing an error can sometimes lead to it never actually being thrown with a never resolving promise. So the promise should be rejected instead.
73f2926 chore(deps-dev): bump @babel/traverse from 7.17... - dependabot[bot]
Bumps @babel/traverse from 7.17.3 to 7.23.2.
Release notes
Sourced from @babel/traverse's releases.
v7.23.2 (2023-10-11)
NOTE: This release also re-publishes @babel/core, even if it does not appear in the linked release commit.
Thanks @jimmydief for your first PR!
:bug: Bug Fix
babel-traverse
#16033 Only evaluate own String/Number/Math methods (@nicolo-ribaudo)
babel-preset-typescript
#16022 Rewrite .tsx extension w...
[discordjs/guide] New branch created: dependabot/npm_and_yarn/babel/traverse-7.23.2
Please describe the changes this PR makes and why it should be merged:
The handler on the Command handling page doesn't work for command categories.
I do not understand the issue, can you elaborate? Timestamps are set and compared based on the same source of truth.
Describe the bug
Send one file with AttachmentBuilder in a message, but sometimes two are displayed in discord. I'm not sure if this is a problem with discord UI or the discord.js SDK.
To Reproduce
#1145682916177887243 message
Screenshots
No response
Device (please complete the following information)
discord.js v14.13.0
Additional notes
No response
We cannot look over message links we do not have access to. We also cannot read minds (we do not know what you are doing, your Node.js version, your discord.js version, any sample or reproducible code, etc.).
We cannot look over message links we do not have access to. We also cannot read minds (we do not know what you are doing, your Node.js version, any sample or reproducible code, etc.).
I updated the report information, the same code normally should look like the screenshot below, but sometimes the above screenshot appears.
Please describe the changes this PR makes and why it should be merged:
Added return statements to the SlashCommandOptions.
-> no return statements will cause an internal error
That is just not how javascript works
This was true, if we made a function body, denoted with {}
() => {
1 // 1 is not returned here, the function will evaluate as undefined, if called
}
However, here we use immediate return
() => 1 // 1 is returned here
The braces can only be omitted if the function directly returns an expression. If the body has additional lines of processing, the braces are required — and so is the return keyword. Arrow functions cannot guess what or when you want to retu...
Is your feature request related to a problem? Please describe.
The Cooldowns page provides code solely based on the Command Handler, but doesn't take into account that the Event Handler was mentioned before in the list.
Describe the solution you'd like
I feel as though it would be considerate to add in a section on the cooldowns page for those who followed the Event Handling guide.
Describe alternatives you've considered
No response
Additional notes
No response
I don't know why I do this to myself, but decided to give Typescript a go and update the code accordingly.
Sadly, some things that work on Javascript, Typescript starts complaining about, even when it looks like they should work, but I'm probably missing some basic stuff.
I'm having this issue first. When crating a message with components, this error comes up.
CLIENT.on(Events.MessageCreate, async (interaction) => {
if (interaction.author.bot) {
return;
}
if (interact...
Welcome to TypeScript!
const ROW = new ActionRowBuilder().addComponents(
ActionRowBuilder must have a generic that specifies what kind of components it holds. See the guide.
<hr>
Your second issue is TypeScript protecting you. isCommand() only allows context menu interactions and chat input interactions through. However, context menu interactions do not have a .getInteger() method. In the...
This pull request integrates the directory-import module into both command and event handling, aiming to streamline the import process.
Updates include:
Command Handling: The manual method of importing each command from the commands directory has been replaced with the directory-import module, simplifying command management.
Event Handling: Similarly, the module has been implemented for event handling. This should simplify and improve the current process which depends on manual work....
Welcome to TypeScript!
const ROW = new ActionRowBuilder().addComponents(
ActionRowBuilder must have a generic that specifies what kind of components it holds. See the guide.
<hr>
Your second issue is TypeScript protecting you. isCommand() only allows context menu command interactions and chat input command interactions through. However, context menu command interactions do not have a `.getI...
Great! But how can I open a modal when the user clicks the button on a specific channel?
You can find a guide on building and sending modals here. Button presses will emit the interactionCreate event as demonstrated here. The typeguard will be isButton() instead of isChatInputCommand(). And you can further narrow down which button it is, by comparing the [.customId](https://old.discordjs.dev/...
I second this, having issues getting this to work. not sure what to do now.
Please describe the changes this PR makes and why it should be merged:
First, [`path.join()`](https://nodejs.org/api/path.html) helps to construct a path to the `commands` directory. The first [`fs.readdirSync()`](https://nodejs.org/api/fs.html#fs_fs_readdirsync_path_options) method then reads the path to the directory and returns an array of all the folder names it contains, currently `['fun', 'moderation', 'utility']`. The second `fs.readdirSync()` method reads the path to these directories and returns an array of all the file names they contain...
19c8faf fix(command-handling): use handler for command ... - Idris1401
8191af2 fix(popular-topics): typo in terminology (#1521) - sdanialraza
fb3c7ae refactor(create-your-bot): bots are always crea... - Jiralite
[discordjs/guide] New branch created: refactor/no-bot-creation
68f4104 fix(creating-your-bot): Update .env links - Jiralite
[discordjs/guide] New branch created: fix/env-links
These links no longer work. I believe the new links are correct.
[discordjs/guide] New branch created: fix/command-handling-cleanup
Following the guide from the beginning, there are some changes that need to be made to this page.
- The utility folder is the only folder present when looping over command folders.
- Command categories are already present (per the point above). There is an entire repeated section duplicating code and explanation here.
- Removed "bonus commands". They should be introduced if they are actually introduced in the guide.
- Code samples were not 1:1 with the implementation in prior sections. ...
1f1f5bc fix(command-deployment): Cleanup page - Jiralite
[discordjs/guide] New branch created: fix/command-deployment-cleanup
Following the guide from the beginning, there are some changes that need to be made to this page.
- Important comment difference between guide and code sample regarding folders vs. files
- Removed "bonus commands". They should be introduced if they are actually introduced in the guide.
- Code samples were not 1:1 with the implementation in prior sections. This may cause confusion.
6623016 fix(event-handling): Cleanup page - Jiralite
[discordjs/guide] New branch created: fix/event-handling-cleanup
Following the guide from the beginning, there are some changes that need to be made to this page.
- The
Events.InteractionCreatecode wasn't up-to-date. - Code samples were not 1:1 with the implementation in prior sections. This may cause confusion.
- This page interacts with
Events.InteractionCreate, so I decided to dump the commands folder in the code sample.
3546390 fix(additional-features): Cleanup pages - Jiralite
[discordjs/guide] New branch created: fix/additional-features-cleanup
[guide] Branch fix/additional-features-cleanup was force-pushed to `1875f68`
Following the guide from the beginning, there are some changes that need to be made to this page.
- Preferred
const { cooldowns } = interaction.client;. - Removed "bonus commands". They should be introduced if they are actually introduced in the guide.
- Code samples were not 1:1 with the implementation in prior sections. This may cause confusion.
efd0d4b fix: Add cooldown to all commands - Jiralite
Resolved with 32fd7d587480a70097418937299a6a0f24fca0c6.
It might be better to base it after the previous sections (so the event handler) instead of the command handler.
did we really not call that client across the board, c, really? that's unfortunate
if i am not confusing this with something else, we removed this elaborate error handling for a reason; namely that it can still fail in edge cases and is not really beneficial to the teaching of this section or broader chapter
It's a tradeoff between shadowing the variable, and showing that the event emits the client instance. It becomes relevant when we do event handling as it's no longer shadowing, but isn't relevant at this point in the guide.
as said in the other PR i'm really not sure why we introduce this duplicate with this horrible naming convention
if it has no purpose I personally don't think we need it here and can instead introduce and explain it once it does make sense to have.
On the other hand, I can see the idea behind introducing the fact here, but if we go with that approach, let's find something nicer than c to establish verbose and understandable variable names as convention and best practice.
All gateway intents, and the events belonging to each, are listed on the [Discord API documentation](https://discord.com/developers/docs/topics/gateway#list-of-intents). You can also find the enum values used in discord.js [here](https://discord-api-types.dev/api/discord-api-types-v10/enum/GatewayIntentBits).
5987e7e feat(intents): add dapi types reference (#1505) - EthanTFH
If we are to revisit our folder reading, we will likely implement a well-established package like readdirp or glob (#1486).
2c77ef2 chore(deps-dev): bump postcss from 8.4.16 to 8.... - dependabot[bot]
144ee6e chore(deps-dev): bump @babel/traverse from 7.17... - dependabot[bot]
For TypeScript users, c here will be emitted as Client<ready> whereas the previously-defined client is of type Client<boolean>. This means you won't be able to access client.application even though it's definitely defined in the ready event, so you'll have to do a pointless client.isReady() check.
523f655 refactor(create-your-bot): bots are always crea... - Jiralite
sounds good! everything is better than single characters as variable names and explaining why this is useful (and for who) is def. a good idea
00ab038 refactor: Standardise ClientReady event - Jiralite
[discordjs/guide] New branch created: refactor/client-ready
Per https://github.com/discordjs/guide/pull/1525#pullrequestreview-1747094664, this event has been standardised everywhere it should be in the guide.
The first instance of this when following the guide is at guide/creating-your-bot/main-file.md. There were some code comments already, so I appended why this is useful for TypeScript users.
// The distinction between `client: Client<boolean>` and `readyClient: Client<true>` is important for TypeScript Developers.
// It makes some properties non-nullable.
I think i prefer more concise wording here, while adding some verbosity about the specific types.
Please describe the changes this PR makes and why it should be merged:
I rearranged the username and password line in the ES6 example to match exactly the ES5 example. Then people won't get confused.
2e10756 chore(es6-syntax): rearrange username and passw... - DylanDevelops
Hmm, not that I can see. The only way this could fail is if the interaction expires somehow.
[email protected]Please describe the changes this PR makes and why it should be merged:
i remember us having issues with handling this in our bot, but that's good enough for now
[guide] Branch fix/command-deployment-cleanup was force-pushed to `6648019`
[guide] Branch fix/additional-features-cleanup was force-pushed to `f7a859e`
1202eee fix(additional-features): Cleanup pages (#1527) - Jiralite
Personally I'd be against having this as its own article. A more general Popular Topics > prism-media guide would make sense. On its own, this just feels like a guide for FFmpeg; one that already exists at that. This and "Decoding an Opus stream" as examples would cover the only two features of prism-media that realistically would need to be implemented separately from @discordjs/voice as of right now. As a side note, it could also be mentioned th...
I have been following the instructions in the guide here https://discordjs.guide/creating-your-bot/event-handling.html#resulting-code.
Is it the expected behavior to have the event handlers invoked sequentially? (I mean one by one, in FIFO fashion)
Thank you for any insights.
Describe the bug
Following the guide or just copy pasting the files from Github results in node error.
PS C:\Users\User\Desktop\discord-bot> node .\deploy-commands.js
node:internal/fs/utils:350
throw err;
^
Error: ENOTDIR: not a directory, scandir 'C:\Users\User\Desktop\discord-bot\commands\ping.js'
at Object.readdirSync (node:fs:1527:3)
at Object. (C:\Users\User\Desktop\discord-bot\deploy-commands.js:14:26)
at Module._compile (node:internal/modules/...
Describe the bug
Following the guide or just copy pasting the files from Github results in node error.
PS C:\Users\User\Desktop\discord-bot> node .\deploy-commands.js
node:internal/fs/utils:350
throw err;
^
Error: ENOTDIR: not a directory, scandir 'C:\Users\User\Desktop\discord-bot\commands\ping.js'
at Object.readdirSync (node:fs:1527:3)
at Object. (C:\Users\User\Desktop\discord-bot\deploy-commands.js:14:26)
at Module._compile (node:internal/modules/...
There is a step in the command loading/deployment process which has you move the files to subfolders, and reads them accordingly. The code you have copied appears to be halfway between - it's attempting to read ping.js as a folder, when it isn't one.
The second error is unrelated - you are attempting to deploy commands to a single guild without providing a guild id.
Please head on over to our Discord server for more help.
Guide states to create a(1) commands/utility folder and drop the files in. Cant name folders on Windows with "/" in them so i just named it commands and dropped them in there which results in the first error.
The Command Handling Section then talks about a utility folder inside the command folder.
Im not a native english speaker so it might just be the language barrier. But in my understanding the guide tells me to create one folder in the Slash Commands Section.
Of course not, a / is a path separator, not part of the name. That line should be read as "create a new folder named utility inside commands". If we need to be more explicit about that, I guess we can change it.
Well that makes a lot of sense now.
Thank you for answering so quickly!
Please describe the changes this PR makes and why it should be merged:
b681fd0 fix(select-menus): string select menu highlight... - ArnavK-09
Please describe the changes this PR makes and why it should be merged:
The wording there can be pretty confusing, so this clarifies things to avoid that
@ducktrshessami Yeah, that's true enough, but honestly, this will eventually fit in voice section. Because adding content like this in popular topics does not related to discord.js directly. Adding this in voice section (because u know how do you use these things in other part of discord.js bot developing).
I wasn't referring to the "Popular Topics" section of the main guide. I agree that a guide about prism-media is more relevant in the Voice guide. I am simply opposed to this as a standalone article. A new "Popular Topics" section can be added since this isn't directly related to @discordjs/voice. If you do agree I'd definitely like to see this rewritten before being merged.
I wasn't referring to the "Popular Topics" section of the main guide. I agree that a guide about
prism-mediais more relevant in the Voice guide. I am simply opposed to this as a standalone article. A new "Popular Topics" section can be added since this isn't directly related to@discordjs/voice. If you do agree I'd definitely like to see this rewritten before being merged.
I see I got it. So you mean, like creating new 'Popular Topics' in voice MD and referring this kind of articl...
Please describe the changes this PR makes and why it should be merged:
Pretty simple grammar fix. The current one would expand to this if you removed the contraction:
"Although the String select menu with it is user-defined options..."
e199aaa fix(select-menus): Improper "it's" contraction ... - 3vorp
I believe this could be because fs.access is asynchronous and sometimes code runs before another chunk has been run.
I would try restructuring your code to something like this and seeing if it works:
if (message.content.startsWith("!play")) {
fs.access('test.ogg', fs.constants.R_OK | fs.constants.W_OK, (err) => {
if (err) {
console.log("file not found");
return;
} else {
bgores = createAudioResource('test.ogg', {
...
Fixed contraction error when referring to the reader's event handling.
Text block under "syncing the model" highlighted wrong line (previously highlighted line was not new code and new highlighted line is correct)
was written as both 60000 and 60_000 as the same line of code in different example blocks
Well its more readable this way, you should change the other example to follor the _ syntax
Please describe the changes this PR makes and why it should be merged:
Using client while constructing it leads to it being of type any instead of Client. Accessing it from the callback parameter fixes this.
59aa06b fix(cache-customization): Access client from ... - sdanialraza
47c9d0e fix(sequelize): Highlight correct code change i... - man-o-valor
This portion of the guide is confusing because it does not work with a previous section title "Command Categories" which has the user move commands in to subcommand folders.
Just pointing out that this issue is resolved.
Part of the guide or code sample the question is about
There are a number of times that the term 'target' is used to explain a method, however in most if not all cases this term is not given context. In the getRole('target') example, it would be helpful to know if the 'target' was the role id or the the role name provided as a string.
It would also be helpful if the getRole method could be officially written about in the documentation. It's all too vague for me. The same applies for t...
'role', 'target', etc. are the option names you want to get the value of, these methods are documented here.
Thank you for your response. I think there was another issue with my code so I will mark this as resolved. Thanks again for your time.
Please describe the changes this PR makes and why it should be merged:
- Use descriptive parameter names in events
Implicit grant flow is recommended by the guide for SPAs, however the IETF does not recommend using Implicit grant flow in any scenario, preferring the Authorization code grant.
Couple of notes on this. Personally, I'd rather just rework the guide not to use implicit grant at all. In many other areas of the guide, we moved away from showing people a "bad but easy" way to do things, then changing it all in the next section. Just show the right way from the start.
Otherwise if we do want to stick with a warning, using [here] as the masked text on a link is poor accessibility for screen readers. Prefer something descriptive like `for more information check [the OAu...
I can change the pr to remove implicit grant completely if that would be preferable.
If we decide to keep implicit grant, I'll change the masked text to make it more clear, thanks for the heads up on that.
71f70de chore(deps-dev): bump vite from 2.9.16 to 2.9.17 - dependabot[bot]
Bumps vite from 2.9.16 to 2.9.17.
Changelog
Sourced from vite's changelog.
2.9.17 (2024-01-19)
fix: port #15653 to v3 (#15655) (0cd769c), closes #15653 #15655
Commits
3441f12 release: v2.9.17
0cd769c fix: port #15653 to v3 (#15655)
See full diff in compare view
[. Unfortunately, almost everything was in English, and a few years ago (when I was much s...
We are not planning to offer native translations for the guide at this point.
This has to do with how the guide is currently set up, iterated, and maintained.
You are free to fork the project and host your translation (as done by the discord.js japan user group, for example, https://github.com/discordjs-japan/guide) following the MIT license https://github.com/discordjs/guide/blob/main/LICENSE
Please describe the changes this PR makes and why it should be merged:
- Prefer the usage of enums
- Replace the deprecated
underscoreformatter withunderline
Is your feature request related to a problem? Please describe.
Most people have a problem understanding the structure of the folders when it comes to command handlers in the guide.
Describe the solution you'd like
Using glob will help with nested folders as well has non-nested folders, but making the guide just a little harder to understand.
https://www.npmjs.com/package/glob
Glob can also be promisified using node:util. Node supports top-level await as well.
Describe alter...
There‘s a PR for that already: #1486
Which application is this bug report for?
Guide
Issue description
In the reload commands guide, it says commands are not actually deleted instead overwritten by the new command, but the snippet provided does actually deletes the command. See attached pic for reference
Steps to Reproduce
- Go to [Reload Commands](https://discordjs.guide/...
As described below you should not delete the command from the commands collection but the code snippet does delete it.
Please describe the changes this PR makes and why it should be merged:
It removes the code in the snippet for deleting the command from the commands collection on client.
It should be merged to show a correct example of the described text below it.
Part of the guide or code sample the question is about
name: Question/General support request
description: Ask questions about the guide.
labels: ['question']
Question
`body:
-
type: textarea
id: scope
attributes:
label: Part of the guide or code sample the question is about
description: URL or path to the file or section in question. If none please select "feature request" instead.
validations:
required: true -
type: textare...
Part of the guide or code sample the question is about
i mean voice messages like this one:
Question
Can bot send voice (aka audio) messages as users can send in mobile app?
Part of the guide or code sample the question is about
i mean voice messages like this one:
Question
Can bot send voice (aka audio) messages as users can send in mobile app?
thanks for moving it to discussions so quick, so how can i send such a voice message?
It is not supported for bots to send voice messages.
How do I change the topic of the voice channel?
I tried the following:
client.channels.cache.get('11598340623541xxxx').edit({topic:'test1'}).then(console.log).catch(console.error);
But this doesn't work.
-------DiscordAPIError: Invalid Form Body
-------topic: Channel topic contains at least one word that is not allowed.
another attempt:
client.channels.cache.get('11598340623541xxxx').setToic("test").then(console.log).catch(console.error);
But this doesn't work.
------- Type...
do you plan to know the value and implement it? are there any links to examples please?
Implementation of features, as per usual, will happen once they are properly documented in the upstream API documentation and thus supported.
Is your feature request related to a problem? Please describe.
Your current tutorial is filled with require() and module.exports. Converting to the ES6 import/export does not work.
- your dynamic command file setup has a require() that I could not figure out how to replace (admittedly, still learning node, but getting fairly proficient at it)
- get error "SlashCommandBuilder is not a constructor" trying to convert command module
Describe the solution you'd like
I would like t...
Thanks for the feedback - we do have plans to rewrite the examples to ES6. In fact, many already have been but the updated guide has not yet gone live.
For information on how to use ES6 import correctly, check out https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
For example, importing SlashCommandBuilder is import { SlashCommandBuilder } from 'discord.js';
The equivalent to the in-line require() you mentioned is the dynamic import: https://develop...
Thank you for the response. I am looking forward to that update, as every other tutorial I could find also used the require() syntax, despite saying it's updated for ES6...
In regards to your helpful advice and links:
1: I did import the SlashCommandBuilder in that way, but running the code gives me an error that SlashCommandBuilder is not a constructor. Worked fine if I c/p the lines directly into my index.js though.
2: I did try the import() function, but trying to use the object that s...
Along with ES6, it will be great if you add TypeScript examples :)
events branch has been deleted during this commit, and part of multiple sections are now missing.
It might be better to base it after the previous sections (so the event handler) instead of the command handler, purely for this reason.
I disagree, as this part of following through is now broken due to incorrect commits.
That is not a valid reason. If there is a separate bug, that should be reported in itself.
Is your feature request related to a problem? Please describe.
I was attempting to create a mute command and came over timeout. A option would be to set the time they are timed out however the guide has member.timeout(60_000); Is the underscore needed, how would I make it a option and those questions are the ones I've thought of.
Describe the solution you'd like
Show IF the underscore is not needed and if it is easily customisable eg member.timeout(60_000 * multiplier); where m...
The guide is aimed at beginners with discord.js, not people who haven't used the language.
We do not explain base language features like strings, functions, and expressions. For the same reason explaining numbers feels out of scope for the guide.
Using math expressions instead of a number is just base JS. At any point, an expression that evaluates to a number can be used instead of a number literal.