#archive-github-djs

1 messages ยท Page 5 of 1

heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
While creating a slash command like in v12 and then setting the permissions I receive an error back (although no error appears to occur).

The permissions actually work as intended however it does return the following error:

TypeError [INVALID_TYPE]: Supplied permissions is not an Array of ApplicationCommandPermissionData.
    at ApplicationCommandPermissionsManager.set (/redacted/node_modules...
#

Out of curiosity,

  1. how is it the wrong type? Pretty sure the class takes in raw data from Discord
  2. How are you affected by this? ๐Ÿ‘€

The commit before you PR'd breaking changes, worked fine with the type as ApplicationCommandData

1: Changing it to a raw datatype requires the user to input application_id and id which I don't think is intended

2: What I said above, when doing


new ApplicationCommand(// params, {
// application_id and id are required here
}...
#

this is what we are doing right now,

      this.slashCommand = new ApplicationCommand<Record<string, unknown>>(
        client,
        {
          ...options.slashCommand,
          name: this.name || options.name || '',
          description: this.description || options.description || '',
          options: options.slashCommand?.options || undefined
        }
      );```
      
      This has worked for a while now, it only works when adding application_id and id now. What...
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Because we don't need some 3rd party with arbitrary and opinionated rules evaluating our code.

Not to speak of the fact that it conflicts with our prettier rules (using an outdated version themselves) and will mess up our CI.

So why do you have eslint checky in github actions

And where are your rules?

#

My bot is down for hours at a time because of this issue, I'm running 7 shards and getting rate-limited almost immediately on boot. I don't understand why it suddenly started getting rate-limited a week ago, and again today, is this really on Discord's end?

Also very unhelpful, ShardingManager appears to just throw an unhandledexception when this occurs, it does not display any sort of 429 error, which made this extremely confusing to debug...

Is this still an issue? If so, what d...

heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:

In v13, Permissions#missing returns all permissions, not only the provided ones.

Include a reproducible code sample here, if possible:

guild.me.permissions.missing(Permissions.FLAGS.ADMINISTRATOR)

This should only return the ADMINISTRATOR permission, since it's the only one passed as argument, in v12 works as intended but v13 seems to return all permissions, i'm not sure if those ar...

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

Add GuildStickerManager and GuildInviteManager to list of configurable Caches, as both extend CachedManager.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:

Include a reproducible code sample here, if possible:

// Place your code here

Further details:

  • discord.js version:
  • Node.js version:
  • Operating system:
  • Priority this issue should have โ€“ please be realistic and elaborate if possible:

Relevant client options:

  • partials: none
  • gateway intents: none
  • other: none
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
The new example of the README was missing a semicolon, added it for consistency with the styling since the guide has that semicolon and it's used everywhere else at the end of functions

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR only ...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

While the direct issue outlined in #6168 has been fixed in #6263, the same issue still persists for old messages sent in this same channel. As outlined in the issue the least intrusive way to fix this I could think of is making Message#channel a getter to retrieve the channel from cache on demand. I use the Client cache (versus the guild cache) to be robust against DMs, if that has any caveats I did not think of, ...

heavy crowBOT
#

Getting the channel from an Interaction require a pretty long boilerplate code (see below). I propose to add some shorcut method to Interaction.

Maybe the name fetch is not appropriate since it doesn't fetch in all case.

I know the policy is to avoid trivial shorcut method, but this one could help improve code readability.

const channel =
    interaction.channel ??
    (interaction.channelId
        ? await (
              interaction.guild ??
              (interacti...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
Yet another README pr, this one removes the "this is still for stable" message from the guide link and changes the update guide link to v13 changes, since the old one is for v12

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR only includes...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
Some links related to interactions were wrong (you can tell straight away because there was no - separating the words!) - I've gone ahead and pointed them to the correct area.

APIInteractionDataResolvedChannel & APIInteractionDataResolvedGuildMember were missing documentation links, so I've gone ahead and pointed them to https://discord.com/developers/docs/interactions/slash-commands#interaction-object-applic...

heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Remember that these are not types and only serve for documentation purposes. Once someone clicks either one of those they will be sent to the same page and will need to figure out what they should be looking at. I argue some may even be confused and call these a bug but there's not much we can do. You could also try a weirder syntax used in typescript which would be something like APIInteractionDataResolvedOption['member'] so that they know what property to look at when they open the page. ...

#

Remember that these are not types and only serve for documentation purposes

These are types, I'm not sure what you mean?

export interface APIInteractionDataResolvedChannel extends Required<APIPartialChannel> {
  permissions: Permissions;
}

export interface APIInteractionDataResolvedGuildMember extends Omit<APIGuildMember, 'user' | 'deaf' | 'mute'> {
  permissions: Permissions;
}

Changing them away from these types means we wouldn't be using any types at...

#

I've spent about 5 hours updating my code to work with v13 from v12 and I got to a point where I physically can't move any further.
I've spent at least 2 hours trying to get it to work and I'm just getting no where, channel.setParent() is doing absolutely nothing, no error and the channel doesn't move into a diff category.

client.on('messageCreate', async message => {    
        if (message.content.toLowerCase() === '!test') {
            var guild = client.guilds.cache.get('847...
#

Seems like this happens because if you have a permission bitfield of 8n (ADMINISTRATOR) and call .toArray() on it, it will resolve into all permissions which seems counter intuitive. Can you check if this behavior also happens on v12?

calling .toArray() gives the same output in both v12 and v13

You may be interested in the checkAdmin parameter, e.g.

guild.me.permissions.missing(Permissions.FLAGS.ADMINISTRATOR, false)

This indeed fixes de issue, but as @Im...

#

I suppose the common use case would be to have checkAdmin=true for this, but checkAdmin=false for bits.
So that:
[admin].missing(manage_webhooks) => [] admin means everything here
[manage_webhooks].missing(admin) => [admin] admin only means admin here, not everything

So 2 parameters with probably these defaults?
Now a descriptive docstring for these would be nice. ๐Ÿค”

This makes sense, but the thing is currently .missing without checkAdmin flag set to false...

#

I suppose the common use case would be to have checkAdmin=true for this, but checkAdmin=false for bits.
So that:
[admin].missing(manage_webhooks) => [] admin means everything here
[manage_webhooks].missing(admin) => [admin] admin only means admin here, not everything

So 2 parameters with probably these defaults?
Now a descriptive docstring for these would be nice. ๐Ÿค”

I believe this isnโ€™t the way to go. The fact that [admin].toArray (Where [admin] is the ...

heavy crowBOT
#

Hello everyone,

Everything is in the title. It is reproducible with the current master version, which I pulled 2 hours ago. I don't have a specific commit number, it doesn't seem very important.

Replying interacts with an embed message that contains images, while being ephemeral, prevents the images from being displayed. Proof in the following capture with and without ephemeral.

let messageEmbed = new MessageEmbed();

messageEmbed.setAuthor('Extension pour navigateurs', "att...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
Since the addition of default auto archive durations to Discord, the autoArchiveDuration parameter is now optional on the Discord API (tested). This PR marks that parameter as optional on the docs and types.

๐ŸŒŠ Upstream PR: https://github.com/discord/discord-api-docs/pull/3567

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
MessageButton#setDisabled and MessageSelectMenu#setDisabled currently need to be passed a parameter set to true to actually disable them. This PR defaults said parameter since the method name implies this functionality

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't n...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
Since #5906 interaction channels get resolved by Action#getChannel, however this method does not account for the User being in data.user for interactions instead of data.author. Since the interaction data does not include a 'user_id' field a partial user with the id of undefined gets added to the cache if the interaction is triggered from a DM channel.
I am not too familiar with discord.js internals, so I hope this...

#

Please describe the changes this PR makes and why it should be merged:
Client#_finalize is currently showing up in the docs due it being not marked as private

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR only includes non-code changes, like changes to documentation, README, etc.
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

Discord.js is not meant to be cache independent in its current state. The option to override caches is provided but overriding some of these caches will cause major issues internally. Those caches are: GuildManager, ChannelManager, GuildChannelManager, RoleManager, and PermissionOverwriteManager.

| โš ๏ธ Overriding the cache for any of the managers listed above is now considered unsupported. Unsupported m...

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

Fixes a bug where the client would not emit ready despite being ready, having to wait 15 seconds instead when no guilds intent was specified

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

wouldn't it be better to just put it in the docs and/or guide instead of also logging a warning? or at least add a way to disable the warning

Although I did add it to the docs, the process warning is a much more present warning. It will only emit the warning once per process run, so up to 5 total warnings. It's more of a reminder like "hey, things are gonna break" and I don't want people just disabling the warning because they saw someone else do it.

why not just remove the function...

heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

At the moment, if Discord adds a new channel type, we have to update the types in many places, this creates issues as far as the type consistency go, such as MessageCollector not accepting NewsChannel as a valid channel type.

I also considered #6262 as an alternative fix for this, however, a generic type doesn't have many of the benefits from an union, such as being able to exclude certain types (`channel.guild ?...

heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
When creating or editing permission overwrites for channels my client is unable to toggle any of the MANAGE_THREADS, USE_PUBLIC_THREADS, USE_PRIVATE_THREADS
permission flags despite it being documented and it being told within the support server that those permissions are supported
It throws no errors, whether it be caught or not
And does not work as intended for those particular permissions

**Include a rep...

heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
My Discord Bot is not receiving 'interactionCreate' and 'messageCreate' events. I have latest version of discord.js installed (version number below). The 'message' event is working fine. My command is registered correctly and is visible in Discord.

Include a reproducible code sample here, if possible:

const Discord = require('discord.js');
const { token } = require('./config.json');

const clien...
heavy crowBOT
#

I'm having the same issue as well, following the guide here - https://discordjs.guide/interactions/registering-slash-commands.html

@Jiralite the latest tag is 12.5.3 per https://github.com/discordjs/discord.js/tags, and the documentation includes instructions to use messageCreate and interactionCreate. Where does one source v13.x.x? NPM registry notes 12.5.3 as latest as well.

#

At this point in time, the guide is meant to be used for creating v13 bots. v13 hasn't been completely released yet, you may install a pre-release by using npm install discord.js@dev. The guide for v12 is accessible at https://v12.discordjs.guide, however, it is advised to start making your bots compatible with v13 as early as possible, and this includes creating new ones.

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This PR makes a small change to Collector#checkEnd to make it return a boolean representing whether or not the collector ended.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
#

Please describe the problem you are having in as much detail as possible:
The client crashed after disabling the member and user cache (GuildMemberManager: 0, UserManager: 0) and listening to the userUpdate event. I was expecting it to be emitted with some data or partial data.

Error:

/media/vicente/Secundario/Desktop/Proyectos/djs-limited-caching/node_modules/discord.js/src/client/actions/UserUpdate.js:11
    const oldUser = newUser._update(data);
                  ...
#

We would have to investigate completely disabling the UserManager though.

Chances are completely disabling it will be unsupported. Our userUpdate event isn't exactly the raw update from discord.

You could try setting it to like 10(?) or so, this should solve your problem. Or even 5 for that matter.

Also disabling your GuildMember cache like that will make you unable to check for your own clients permissions, is that intended in your use case?

heavy crowBOT
#

Also disabling your GuildMember cache like that will make you unable to check for your own clients permissions, is that intended in your use case?

No, that was not my intention.

In this case the error happened when a user changed their username, if it was emitted by a gateway event it would be useful in case a developer wants to reduce memory consumption and just cache the client using the keepOverLimit option, but also be able to listen to the userUpdate event to provide logging.

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

This is an addendum to #6212, it simply exports the different button option variants, and cleans up definitions.

Status and versioning classification:

Please move lines that apply to you out of the comment:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:

Include a reproducible code sample here, if possible:

const { Client, MessageEmbed, MessageActionRow, MessageButton, Intents } = require("discord.js");
const client = new Client({intents: [Intents.FLAGS.GUILDS,Intents.FLAGS.GUILD_MESSAGES]});
let page = 0;
const pages = [
    (new MessageEmbed).setTitle("Page 1"),
    (new MessageEmbed).setTitle("Page 2"),
    (new MessageEmbed).setTitle...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

This PR fixes a grammar mistake in the documentation, which can be found somewhere like here. "An Sticker" is not correct, and neither is "an StickerResolvable", and should be "A sticker" instead because Sticker is not a vowel.

Status and versioning classification:

  • This PR only includes non-code changes, like changes to documenta...
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
When I trying to call user.username on Client instance, it's returns undefined.

Include a reproducible code sample here, if possible:

...
const client = new Client({ intents: [ Intents.FLAGS.Guilds ] });
console.log(client.user.username); // undefined
...

And here is output of the console.log(client):

[
   Client {
    _events: [Object: null prototype] {
      shardD...
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

@kyranet and I found the bug when updating @skyra/editable-commands
when our custom function that accepted an argument of MessageTarget
was suddenly no longer accepting message.channel. Turns out it was
because of a mistake @kyranet made lulz

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done...
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
Adds isVoice() type guard to Channel. We already have isText() and isThread(), so it's logical to have one for voice-based channels as well.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or para...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
I went through every page on the docs and added/fixed some things. Although the title says docs this does include very small changes to the typings and code which I will be detailing below and you're welcome to give your opinion on them if you believe they should be reverted.

โš ๏ธ This PR contains the following breaking changes:

  • Removed the RELAY_ENABLED guild feature as it was not found on the docs
  • Marked `G...
#

You already can control it - disable auto-respawn and listen for the relevant events yourself.

I might be understanding this wrong, but this method allows you to do what you described.

I'd like to direct your attention to the previous comment:

Thanks for the idea, didn't think of doing it manually. If I do implement this manually, I'll post a gist to it. I still feel like this is a feature a broad range of bot owners would find useful.

It is a solution, but it ne...

#

Grammarly also agrees that it should be is. You are only talking about one thing after the or, so it should be is, not are.

Examples:
If the channel, or guild are deleted โŒ
If the message and channel are deleted โœ”๏ธ
If the message, or guild and channel are deleted โœ”๏ธ

The second and third examples make sense because you are referring to both; however, you aren't with the first example.

heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
The issue is im getting

    const token = this.client.token ?? this.client.accessToken;
                                     ^

SyntaxError: Unexpected token '?'
``` which i'm very confused about.
**Include a reproducible code sample here, if possible:**

```js
client.login(process.env['TOKEN']);

Further details:

  • discord.js version: 13 Dev
  • Node.js version: 14
  • Operating syste...
heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:

I got an error from this code.
image

I think discord.js should reply something else

Include a reproducible code sample here, if possible:

.on("ready", () => {
  .guilds.cache.get("Id of a guild").commands.create();
});

Further details:

  • discord.js version: 13.0.0-d...
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
When removing a user reaction from a MessageReaction, when accessing the cache afterwards it still has the user in it.

Issue in a real world example: I have an embed with an either one or other option, and if a user clicks option B I remove their reaction to option A, and re-render the embed with an updated list. This bug is causing the user to show up under both A and B, because I am using the cache for use...

heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This adds a "MAX" option to ThreadAutoArchiveDuration that sets a thread's auto-archive duration to the maximum one, based on the guilds boost count.

I understand that this is not really needed, so here's a couple of reasons this may or should get rejected:

  • Runtime check
  • Changes ThreadAutoArchiveDuration type to number | string (could be solved by setting all options to string and converting later) ...
heavy crowBOT
#

Just one more PR to defer the v13 release

Please describe the changes this PR makes and why it should be merged:

This renames .defer() to .deferReply() and with it also InteractionDeferOptions for more correctness (you do not defer the interaction itself) and better consistency with .deferUpdate() and possible upcoming methods.

I wasn't sure if .deferred should be renamed to .replyDeferred or something like that, so I kept it at the current name for now.

**Status...

heavy crowBOT
#

Although this function can resolve to either a GuildMember, a User or an ID, I think the name user is more appropriate than guildBan because that gives off the idea that it will return a GuildBan object. As for the rest, I did user.user?.tag ?? user.tag ?? user because it can resolve to a GuildMember (user.user.tag), a User (user.tag), or an id (user) and your approach would ignore the scenarios where User is returned

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

This PR renames .deferred to .deferredReply in order to be consistent with the recent change from .defer() to .deferReply() in PR #6306.

I wasn't too sure whether to do deferredReply or replyDeferred, but the only reason I went with deferredReply instead is that it sounds more consistent with deferReply(). If replyDeferred is decided instead I can change it to that. I guess you can see which is better ...

heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

This PR fixes a grammar mistake. Since HTTP is an acronym, and when saying the first H, it sounds like a vowel, it should be "an HTTP" and not "a HTTP".

Status and versioning classification:

  • [x] This PR only includes non-code changes, like changes to documentation, README, etc.
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

Fixes a bug in the current sweeping of caches where ThreadChannels would remain in the client and guild channel caches, only being removed from the thread channel caches.

Allows a bit more control over how thread channels are swept from these caches without triggering the process warning for overriding the channel caches.

Also fixes a minor documentation error in LimitedCollection.

**Status and versioning c...

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

Fixes a hard crash when resolving mentioned roles in previously uncached messages being replied to.
Also passes the guild id that is received with said message reference so that it is more likely the mentions will be resolved.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typi...
#

Please describe the changes this PR makes and why it should be merged:

Fixed the redundant size checks (they aren't working for some time now anymore and with our caching strategy its completely haywire).

Additionally the way the checking for option || force is done could maybe be done differently? I'm open to suggestions on that front.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update...
#
[discordjs/discord.js] New branch created: fix/guild\-member\-fetching
#

Please describe the changes this PR makes and why it should be merged:
The package was updated to node 16 on https://github.com/discordjs/discord.js/commit/a56ba097dce5b476939a10d6dc9250a966356594 so might as well update the CI too

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • This PR only includes non-code changes, like changes to documentation, README, etc.
#
[discordjs/discord.js] branch deleted: fix/guild\-member\-fetching
heavy crowBOT
#
[discordjs/discord.js] New tag created: 13\.0\.0
#

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

Actually using buttons and selectors is boring and brings you to write a lot of code for something witch can be simple, mostly when you just need one or two buttons/selectors.

The action row system hasn't any specific features or options but it's a needed component if you want to work with buttons stuff.

.send({
  content: 'Interact with my beautiful buttons',
  components: [
    new MessageActionRow({
  ...
heavy crowBOT
#

I already thought about it before opening the issue.
The options that Discord could add would not have any impact on this because it's a simple shortcut for simples usage (most of the cases when you use components).
If the developer needs those new features (that Discord could add in the future) he can use the "complicated method" to implement them.
Also (assumption): when you see the roadmap of the planned features for messages components of Discord, these are only optional additions to m...

heavy crowBOT
#
[discordjs/discord.js] branch deleted: master
#
[discordjs/discord.js] New branch created: main
heavy crowBOT
#

Some time this errors appers out of blue

(node:26) UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined
    at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:172:15)
    at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:176:19)
    at RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:50:25)

Further details:

  • disc...
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Is this still an issue? If so, what discord.js/node.js version?

Recently just got the 429 error. I have no idea what caused it. It could be because of the webhooks for errors my bot uses, or maybe it was using the .fetch method too often when fetching a channel (?).

I'm going to try and restart the bot in about an hour to see if it goes away or not by then.

heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:

There're exists a problem with literals on TypeScript lower than 4.2. If you use new types including literals (e.g. HexColorString, UserMention), there occurs a following error: "RangeError: Maximum call stack size exceeded" (you can read about it here, for example: https://github.com/TypeStrong/typedoc/issues/1440 or https://github.com/microsoft/TypeScript/issues/41651). I haven't found anywhere in docs that Typ...

#

Is your feature request related to a problem? Please describe.
I need to change an embed image often, so what i do is when editing the message, use like

edit({embeds: [embed], files: [attachment]})

What this do its to set the message embeds to the array of embeds i pass, and ADD to the attachments the files that i pass.

edit({content: 'Something Amazing!', embed: [], files: []})

This remove all embeds from the image, and does nothing to the files.

**...

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

First(?) semver major PR ready for v14 -- removes the deprecated client message event.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
#

Please describe the changes this PR makes and why it should be merged:

PR #6271 has introduced a regression, because fetched messages do not include a guild_id property in the rest response. This causes Message#guild to become null for fetched messages, even if they were fetched from a guild channel.

  • try to assign the guild id from the channel, if available
  • adapt the Message#guild getter to also return the guild from the Message#channel getter, if necessary and availa...
#

Please describe the changes this PR makes and why it should be merged:

Akin to #6324, removes the deprecated client interaction event.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
#

Please describe the changes this PR makes and why it should be merged:

Removes the deprecated messageSweepInterval and messageCacheLifetime client options, and the sweepMessages client method that they used.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR includes breaking changes (methods removed or rena...
#

Please describe the changes this PR makes and why it should be merged:

Refactors / Fixes the _fetchMany function in a non-breaking but also non-stupid way to actually work as intended (since this is not a REST endpoint either).

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
#
[discordjs/discord.js] New branch created: fix/guild\-members\-fetch\-many
#

Please describe the changes this PR makes and why it should be merged:

Adds the core maintainers with GitHub Sponsors enabled to the funding doc to help point folks in the right direction if they wanna sponsor those that keep this lib going.

Space, ily, but you don't have Sponsors enabled (which is in a way great 'cause the config only allows four usernames)

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code ...
#

Please describe the changes this PR makes and why it should be merged:

Separates out the default options being passed to Options.cacheWithLimits.
This allows devs to change only a single one of the default overrides or add on top without having to redo the rest.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR ...
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:

See title. Only the private fields of options are being populated. The public fields (client and data) are undefined.

Include a reproducible code sample here, if possible:
Here is an example of the issue:
I submit the following registered command:
/blacklist add role queue: 760577441927659541 role: @mod
With the code:

client.on("interactionCreate", async (interaction: In...
heavy crowBOT
heavy crowBOT
#
[discordjs/discord.js] branch deleted: fix/guild\-members\-fetch\-many
#
[discordjs/discord.js] New tag created: 13\.0\.1
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
CDN typings had a surprising number of issues so this fixes them:

  • DefaultAvatar takes "discriminator" (number), not id
  • a few used userId when they were not for users
  • added dynamic option to Avatar and Icon (pulled from the banner prs)
  • a bunch of id args were typed as Snowflake | number for some reason, changed those to just Snowflake
  • some methods actually take format and size in an object (for s...
#
[discordjs/discord.js] New branch created: chore/new\-labels
#
[discordjs/discord.js] branch deleted: chore/new\-labels
heavy crowBOT
heavy crowBOT
#

Is your feature request related to a problem? Please describe.
Currently I'm trying to make a feature of a bot that allows the bot to delete and resend an inline reply as the bot, and I'd like it to conserve the ping option of the initial reply. However, there currently seems to be no way to check this.

Describe the ideal solution
A property of the reply message with a boolean for whether or not it was a ping.

Describe alternatives you've considered
Message#reference ...

heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Correct a typo:

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR only includes non-code changes, like changes to documentation, README, etc.

I just correct a typo in an error message

heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
When I tried to run my bot's source code, I receive this error:

C:\Users\User\Documents\GitHub\Discord-Bot\node_modules\discord.js\src\client\Client.js:544
      throw new TypeError('CLIENT_MISSING_INTENTS');
      ^

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
    at Client._validateOptions (C:\Users\User\Documents\GitHub\Discord-Bot\node_modules\discor...
heavy crowBOT
#

It would be more user friendly for new people who are getting into djsv13 or updating to it to have a default intent of []

const { Client } = require('discord.js');
const client = new Client({intents:[]});
const { Client } = require('discord.js');
const client = new Client(); // Default would have: intents:[] instead of throwing an error.

If it is really necessary to have to throw an error, it would be best to throw a warning instead.

Further details:

  • di...
#

ApplicationCommand#type should be added so that it's possible to check whether the command is a slash command or context menu.

isCommand() and isContextMenu() already do this

That's only on Interaction though. You can't do that with commands that are cached that you've fetched from the API.

// grab context menu commands
guild.commands.cache.filter(command => command.type === ApplicationCommandTypes.USER || command.type === ApplicationCommandTypes.MESSAGE)
#

ApplicationCommand#type should be added so that it's possible to check whether the command is a slash command or context menu.

isCommand() and isContextMenu() already do this

That's only on Interaction though. You can't do that with commands that are cached that you've fetched from the API.

// grab context menu commands
guild.commands.cache.filter(command => command.type === ApplicationCommandTypes.USER || command.type === ApplicationCo...
#

Please describe the changes this PR makes and why it should be merged:

.avatarURL({ format: 'gif' }); throws the following:
Type '"gif"' is not assignable to type 'AllowedImageFormat | undefined'.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
With the default branch now named as "main", I think it would be suitable to correct some links!

In the links section, the documentation was pointing to master branch (instead of main) but a later link was pointing to stable. I just made the links here match.

Let me know if I should amend anything!

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are...
heavy crowBOT
heavy crowBOT
#

Okay so I have now been strugging with this error for a 1/2 days now.

Below I will provide my codes and notes.

Code

const { Client } = require("discord.js");
const { Intents } = require('discord.js');
const Discord = require('discord.js')

const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_BANS, Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS, Intents.FLAGS.GUILD_INTEGRATIONS, Intents.FLAGS.GUILD_WEBHOOKS, Intents.FLAGS....
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:

This PR fixes grammar regarding plural possessives.

In some places, it said something like The value set for a team members's membership state:. Not only is this incorrect (since it would be The value set for a team members' membership state:), but it does make it too consistent with documentation in other places.

For example, for stickers, nowhere does it say The value set for a stickers's type:; inst...

#

As it stands, version 16.6.0 is extremely recent. You can't expect everyone to switch to it

discord.js v13.0.0 is even more recent than node.js v16.6.0, I fail to see how is it more OK to install the former but not the latter.

I would encourage you guys to start transpiling with Babel or similar if new JS features are that important to Discord.js.

To bump to v17-nightly he said.

No, seriously, we can't. It's not only about new syntax requirements, it's more about the node.js b...

heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
The options type this[] as a self reference causes issues when implementing this interface. Changing this to ApplicationCommandOptionData[] fixes this issue https://imgur.com/a/0eVBoJU

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
I had encounter a problem with messages, so Message has properties .deleted and .deletable, I suspected that these properties don't update at all so I've conducted an simple experiment

Include a reproducible code sample here, if possible:
Here's the code

// Receiving the message and everything before this
console.log(msg.deleted, msg.deletable)
await msg.delete()
console.log(msg.deleted, ms...
heavy crowBOT
#

Got a TypeError: Class constructor Client cannot be invoked without 'new' error when i try to run bot.

import { Client, Collection } from 'discord.js'
import { readdirSync } from 'fs'
import { connect } from 'mongoose'
import { Config } from '../config'
import { Command } from '../interfaces/command'

import path = require('path')

export default class Bot extends Client {
  public commands: Collection = new Collection()
  public events: Collection = new Collection()
  ...
heavy crowBOT
heavy crowBOT
#
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

I was just doing my thing making a discord bot then I try to run it with Node.js and this error always pops up

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\ellio\Desktop\Discord-Bot\node_modules\discord.js\src\client\Client.js:544:13)
at new Client (C:\Users\ellio\Desktop\Discord-Bot\node_modules\discord.js\src\client\Client.js:73:10)
at Object. (C:\Users\ellio\Desktop\Discord-Bot\index.js:2:16)
...

#

I was just doing my thing making a discord bot then I try to run it with Node.js and this error always pops up

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\ellio\Desktop\Discord-Bot\node_modules\discord.js\src\client\Client.js:544:13)
at new Client (C:\Users\ellio\Desktop\Discord-Bot\node_modules\discord.js\src\client\Client.js:73:10)
at Object. (C:\Users\ellio\Desktop\Discord-Bot\index.js:2:16)
at...

#

Okay

I was just doing my thing making a discord bot then I try to run it with Node.js and this error always pops up
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\ellio\Desktop\Discord-Bot\node_modules\discord.js\src\client\Client.js:544:13)
at new Client (C:\Users\ellio\Desktop\Discord-Bot\node_modules\discord.js\src\client\Client.js:73:10)
at Object. (C:\Users\ellio\Desktop\Discord-Bot\index...

#

I was just doing my thing making a discord bot then I try to run it with Node.js and this error always pops up
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\ellio\Desktop\Discord-Bot\node_modules\discord.js\src\client\Client.js:544:13)
at new Client (C:\Users\ellio\Desktop\Discord-Bot\node_modules\discord.js\src\client\Client.js:73:10)
at Object. (C:\Users\ellio\Desktop\Discord-Bot\index.js:2:16)...

#

I am having trouble with the .env I try to import it into my code but this error happens

ReferenceError: dotenv is not defined
at Object. (C:\Users\ellio\Desktop\Discord-Bot\index.js:5:9)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.ex...

heavy crowBOT
heavy crowBOT
#

error: `C:\Users\miniozoid\node_modules\discord.js\src\client\Client.js:544
throw new TypeError('CLIENT_MISSING_INTENTS');
^

TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client.
at Client._validateOptions (C:\Users\miniozoid\node_modules\โ†[4mdiscord.jsโ†[24m\src\client\Client.js:544:13)
at new Client (C:\Users\miniozoid\node_modules\โ†[4mdiscord.jsโ†[24m\src\client\Client.js:73:10)
at Object. (C:\Users\miniozoid\Desktop\New folder\nuk...

heavy crowBOT
#

Hello when I try to make my bot send embeds it sends the embed but the next embed doesn't get sent and I get this error,

home/ubuntu/bbarevamp/node_modules/discord.js/src/structures/MessagePayload.js:184
      embeds: this.options.embeds?.map(embed => new MessageEmbed(embed).toJSON()),
                                   ^

TypeError: this.options.embeds?.map is not a function
    at MessagePayload.resolveData (/home/ubuntu/bbarevamp/node_modules/discord.js/src/structures/MessagePay...
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
I can't send a image as a file. I can send text as a file though.

Include a reproducible code sample here, if possible:

// This wont work, even if i write the buffer to a file and try to directly pass the file path to D.JS like so:
/// fs.writeFileSync('./file.png', canvas.toBuffer())
/// message.channel.send({files: [./file.png]})
const canvas = Canvas.createCanvas(len * 30, 50)
        ...
heavy crowBOT
#

Is your feature request related to a problem? Please describe.
I've been using unstable discord.js on 14.17.4 LTS Node.js version with no problems, but I can't install stable release because of the strict version requirement.

Describe the ideal solution
Node engine version requirements being revised.

Describe alternatives you've considered
nvm - too hacky
containers, virtual machines - too clumsy to operate

Additional context

yarn add discord.js
yarn ad...
heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:

I have been trying to connect to the API to register the basic slash commands using the sample code on the discord.js.org. (ref. pastebin below), however, when I start the bot up, the bot itself logs in fine, however, it says that my application is unknown. I recognised that the method changes my inputted IDs. My CLIENT_ID and GUILD_ID are 603340037056102453 and 593830690777333770 respectively but they are change...

heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
Trying to upgrade to the new CacheFactory, but the code editor is noting that I am not typing the correct format. The error is:

Argument type {MessageManager: {sweepFilter: SweepFilter, sweepInterval: number}} is not assignable to parameter type CacheWithLimitsOptions | undefined

Include a reproducible code sample here, if possible:

Options.cacheWithLimits({
  MessageManager: {
...
#
export interface Caches {
  ApplicationCommandManager: [manager: typeof ApplicationCommandManager, holds: typeof ApplicationCommand];
  BaseGuildEmojiManager: [manager: typeof BaseGuildEmojiManager, holds: typeof GuildEmoji];
  // TODO: ChannelManager: [manager: typeof ChannelManager, holds: typeof Channel];
  // TODO: GuildChannelManager: [manager: typeof GuildChannelManager, holds: typeof GuildChannel];
  // TODO: GuildManager: [manager: typeof GuildManager, holds: typeof Guild];
...
heavy crowBOT
#

Discord.js don't work with the foloowing code, and throws out this error:

UnhandledPromiseRejectionWarning: ReferenceError: AbortController is not defined
at RequestHandler.execute (K:\GitHub\taxibot\node_modules\discord.js\src\rest\RequestHandler.js:172:15)
at RequestHandler.execute (K:\GitHub\taxibot\node_modules\discord.js\src\rest\RequestHandler.js:176:19)
at RequestHandler.push (K:\GitHub\taxibot\node_modules\discord.js\src\rest\RequestHandler.js:50:25)
at...

heavy crowBOT
heavy crowBOT
#

Hi,
I want to add a custom emoji as a reaction on a message

with unicode emoji, it work, but with custom it won't

this is the code :

//element contain the id of the emoji, on my test : '806586883240230913'

console.log(message.guild.emojis.cache.get(element));
message.react(message.guild.emojis.cache.get(element)).catch(console.error); 

I got this :

GuildEmoji {
  animated: false,
  name: 'xbirdSga',
  id: '806586883240230913',
  deleted: false,
[...]
...
#

@Fyko Thank you for the pointer. I'm fully aware of such paths to use Node 16.x but most of them will have to change how applications are operated to some extent.

It's really boils down how we open source developers to strive to make users life easy.

  1. Project maintainers and contributors are eager to use latest and greatest syntax. I'm all for it!
  2. Users are keen on backward compatibility as much as possible.

I think the middle-ground is to use TypeScript or Babel and have a bu...

heavy crowBOT
heavy crowBOT
#

This allows to import from specific paths.

Why?
In my case:
Jest does not currently support exports. So when ESM is enabled, and discord.js is imported, Jest resolves the CJS version (main). This commit will allow to import from discord.js/src/index.mjs into the source code to avoid problems with discord.js.

In other cases it would allow to import a specific path which is rather interesting.

Status and versioning classification:

  • This PR only includes non-cod...
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
When I try getting the reactions of a message from .reactions.cache, I'm left with an empty collection. I was told in the support server to open an issue if I could make it reproducible.

Include a reproducible code sample here, if possible:

//Import Modules
const { Client, Intents, Collection } = require('discord.js');

//Create the Client
const client = new Client({ intents: [Intents.F...
#

AWS Elastic BeanStalk only supports Node 12.x.

Sounds like a bad hosting solution if you ask me, I can understand a service not supporting non-LTS versions, but I can't for a version that has been LTS for 10 months (v14).

I think the middle-ground is to use TypeScript or Babel and have a build step to produce JS code that is compatible with all LTS versions of Node, including 12.x.

It's not just language features, also Node.js features, please read the second half of https://gith...