#Legacy guide

1 messages · Page 2 of 1

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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:

drowsy urchinBOT
#

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 ...

drowsy urchinBOT
#

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)
    ...
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
#

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...
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
#

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

[![Dependabot compatibility score](ht...

#
[discordjs/guide] New branch created: dependabot/npm\_and\_yarn/minimatch\-3\.1\.2
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#
[discordjs/guide] New branch created: 14\.8\.0
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#
[discordjs/guide] New branch created: feat/diagnostics\-channel
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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

https://user-images.githubusercontent.com/74485845/224560236-a428602d-16de-4606-a17d-95b269ab231d.mov

To Reproduce

  1. Go to any page of the guide
  2. Click the "settings" dropdown on the left
  3. Select the theme that you're not currently on
  4. See scrollbar on the right (incorrect ...
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#
[discordjs/guide] New branch created: 14\.9\.0
drowsy urchinBOT
drowsy urchinBOT
#

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...

#
[discordjs/guide] New branch created: dependabot/npm\_and\_yarn/webpack\-5\.76\.1
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
#

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...

#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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);
}

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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)
...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#
[discordjs/guide] New branch created: feat/new\-site\-subpackages
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#
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.
drowsy urchinBOT
#
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...
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...
drowsy urchinBOT
#

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

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
#
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.
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
#

Hi! I'm going through the examples from scratch and ran into a few issues above:

  • foldersPath was 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

image

![image](https://...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#
[discordjs/guide] New branch created: 14\.10\.0
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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.`
  );
}
drowsy urchinBOT
#

@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.

drowsy urchinBOT
#

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.

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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.
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
#

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...

drowsy urchinBOT
#

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 ...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
#

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 ...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibilit...

#
[discordjs/guide] New branch created: dependabot/npm\_and\_yarn/vite\-2\.9\.16
drowsy urchinBOT
#

Part of the guide or code sample the question is about

https://discordjs.guide/creating-your-bot/command-deployment.html#guild-commands

Question

I followed the guide up to the step above, but when I executed node deploy-commands.js I got this error:

rawError: { message: 'Missing Access', code: 50001 },

The guide states "Your application will need the applications.commands scope authorized in a guild for any of its slash commands to appear, and to be able to regist...

drowsy urchinBOT
drowsy urchinBOT
#

Part of the guide or code sample the question is about

https://discordjs.guide/creating-your-bot/command-deployment.html

Question

I've successfully followed the guide and now my bot is showing up in my #bot channel and I can see the slash command autocomplete. However, when I press Enter I get the "The application did not respond" error. In the console I see [Flux] Dispatching MESSAGE_SEND_FAILED.

My command ...

drowsy urchinBOT
#

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...

drowsy urchinBOT
#

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 ...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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....

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#
[discordjs/guide] New branch created: 14.12.0
drowsy urchinBOT
#

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
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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. ...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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.

drowsy urchinBOT
#

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)
            ...
drowsy urchinBOT
#

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)
            ...
drowsy urchinBOT
drowsy urchinBOT
#

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)
...

drowsy urchinBOT
#

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)
...

drowsy urchinBOT
drowsy urchinBOT
#

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?

drowsy urchinBOT
drowsy urchinBOT
#

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...
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#
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

drowsy urchinBOT
drowsy urchinBOT
#

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...

#
[discordjs/guide] New branch created: dependabot/npm_and_yarn/postcss-8.4.31
drowsy urchinBOT
#

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...

drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

20231014_151811

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;

...

drowsy urchinBOT
#

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.

Have you tried what Idris said? Using interaction.client instead of client?

#

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.

drowsy urchinBOT
drowsy urchinBOT
#

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.

  1. Go to the interactionCreate.js file
  2. when declaring cooldown in the execute function, assign `const {cooldowns} = interaction.cl...
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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.client in place of client.

  1. Go to the interactionCreate.js file
  2. when declaring cooldown in the execute function, assign `const {cooldowns} = int...
drowsy urchinBOT
drowsy urchinBOT
#

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
drowsy urchinBOT
drowsy urchinBOT
#

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

drowsy urchinBOT
#

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.

drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
#

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

drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#
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...
drowsy urchinBOT
#
[discordjs/guide] New branch created: refactor/no-bot-creation
drowsy urchinBOT
drowsy urchinBOT
#
[discordjs/guide] New branch created: fix/env-links
drowsy urchinBOT
#
[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. ...
#
[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.
#
[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.InteractionCreate code 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.
#
[discordjs/guide] New branch created: fix/additional-features-cleanup
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#
[discordjs/guide] New branch created: refactor/client-ready
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
#

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.

drowsy urchinBOT
#

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.

https://discordjs....

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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 see I got it. So you mean, like creating new 'Popular Topics' in voice MD and referring this kind of articl...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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', {
  ...
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
#

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

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=vite&package-manager=npm_and_yarn&previous-ver...

#
[discordjs/guide] New branch created: dependabot/npm_and_yarn/vite-2.9.17
drowsy urchinBOT
#

Is your feature request related to a problem? Please describe.

¿Why do I write to you?

Since I started on the internet, I had to talk about the majority most of sites I visited being in English. I had always needed many guides, tutorials and resources to strengthen my empirical knowledge and get into different areas of programming (which is a branch of study and practice that I love). Unfortunately, almost everything was in English, and a few years ago (when I was much s...

drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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.

  1. 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)
  2. get error "SlashCommandBuilder is not a constructor" trying to convert command module

Describe the solution you'd like

I would like t...

drowsy urchinBOT
#

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...

drowsy urchinBOT
#

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...

drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
drowsy urchinBOT
#

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.

drowsy urchinBOT
#
[discordjs/guide] New branch created: dependabot/npm_and_yarn/vite-2.9.18