#archive-github-djs

1 messages ยท Page 2 of 1

heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

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

Assume a situation where a text channel is in a category, with the channel's permissions set in Discord to sync with the category.

Accessing GuildChannel#permissionsLocked for that channel will confirm this.

Now, assume that the permissions overwrites in the category are updated, and you have an event listener set for channel updates.

First, you will see the update come through for the category permiss...

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This PR fixes an issue where you'd be able to pass an array of MessageComponents in the components property for MessageOptions where, in fact, you need to pass an array of arrays of MessageComponents. This also makes it so that initializing a MessageActionRow with an empty object in the constructor will now throw an error.
These scenarios will still work:

new MessageActionRow ();
new MessageActionRow({ compo...
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
When Using Util.splitMessage if char is array, it not splited. it's like join ','

Include a reproducible code sample here, if possible:

> Util.splitMessage(`${'a'.repeat('10')}\n${"b".repeat('10')}`,{maxLength: 10, char: '\n'})
[ 'aaaaaaaaaa', 'bbbbbbbbbb' ]
> Util.splitMessage(`${'a'.repeat('10')}\n${"b".repeat('10')}`,{maxLength: 10, char: ['\n']})
[ 'aaaaaaaaaa,bbbbbbbbbb' ]

**Furth...

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This PR adds @links to the isX() methods (isText, isThread, isButton, isSelectMenu, isMessageComponent, isCommand) and also fixes one outdated example in interaction.reply()

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.
heavy crowBOT
#

fix #6006

Please describe the changes this PR makes and why it should be merged:
This PR fixes a problem with Util.splitMessage which doesn't work when the char option is set to an array. This is because the array of messages is mapped and messages splitted again causing the creation of an array of arrays. This PR adds a .flat(1) to prevent this from happening. I also tested this with all options but let me know if there are still problems.

*Sorry for too many commits but I ac...

heavy crowBOT
heavy crowBOT
#

yes, i know this issue is technically voice related but im submitting it here because i believe the code that needs to be fixed is in this repo

Please describe the problem you are having in as much detail as possible:
Since #5941 the typings for @discordjs/voice are included in the main discord.js package. This breaks typescript support for the actual voice library, because typescript just picks up the exports that are declared in the main package. Since this is just a...

heavy crowBOT
#

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

  • message -> messageCreate
  • interaction -> interactionCreate
:warning: Old event names (message and interaction) will still work even after this PR, but a process warning will be emitted.

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This PR Fixes the ClientUser#setAFK typing where the return type was still set as Promise and was missing the shardID argument.

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
#

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

  • All managers are actually managers now:
    • Hierarchy is `BaseManager <: DataManager {
      if (holds === Message) return new LimitedCollection(0);
      return new Coolection();
      }
      });

- Breaking changes in summary:
  - The new managers' hierarchy and methods and constructors.
  - `ReactionUserManager`'s constructor, cus it was weird.
  - Moved options related stuff out of `Constants` into `Options...
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

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

This PR brings two new formatters from https://github.com/discordjs/builders/pull/4:

  • hideLinkEmbed
  • hyperlink

And alongside them, it also adds docs so they're visible in the docs website, however, something I'm unsure of, is whether @namespace works.

cc: @iCrawl

Status and versioning classification:

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

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

I stumbled upon Collector#endReason not appearing in the documentation, so here is a fix.
(Something about the parser not picking up @name'd properties after the last method?)

I added jsdocs to the deriving classes so the now implement property is no longer abstract.
I also marked Collector#endReason as readonly in the typings, all deriving classes do that themselves already however.

**Status and...

heavy crowBOT
heavy crowBOT
#

In both cases the changing PR does not explain why this change was made:

There doesn't seem to be a circular require issue and nothing seems to break when using the appropriate classes instead of this dummy object.

I suppose it's fine to supply the classes again then, although this is probably outside of the scope of this PR.

#

Please describe the changes this PR makes and why it should be merged:
The type for targetType in https://discord.js.org/#/docs/main/master/typedef/CreateInviteOptions was wrong, so I fixed that (now leads to https://discord.js.org/#/docs/main/master/typedef/TargetType)

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...
heavy crowBOT
#

It doesn't, I was adding the type in #5144 but that PR is going nowhere fast. (MessageEmbed already attempts to use it)

All I did was add this typedef

 /**
   * A `Partial` object is a representation of any existing object.
   * This object contains between 0 and all of the original objects parameters.
   * This is true regardless of whether the parameters are optional in the base object.
   * @typedef {Object} Partial
   */
heavy crowBOT
#
[discordjs/discord.js] New branch created: fix/5990
heavy crowBOT
#

I'm unable to reproduce this issue with 374c779 using the following code:

// src/shard.js
import { ShardingManager } from 'discord.js';

const manager = new ShardingManager('./src/index.js', {
	respawn: false,
	totalShards: 1,
});
const shard = manager.createShard(0);
shard.spawn();

// src/index.js
import { Client } from 'discord.js';

const client = new Client({ intents: ['GUILDS', 'GUILD_MESSAGES'], shardCount: 1 });

void client.login...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
After #5318, actual permission overwrites data is accessible via cache of PermissionOverwriteManager, this structure hasn't changed even since the PR. Therefore, attempting to use the latest dev version results in numerous errors.

This PR adds missing cache property to GuildChannel structure, and resolves error caused by unchanged structure.

Status and versioning classification:

  • Code changes have be...
heavy crowBOT
#

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

In the ClientUser file the shardID properties say they can be null in various jsdocs however in the typings file it does not.
The below jsdocs say it can be null
https://github.com/discordjs/discord.js/blob/374c779f7f8bbaa9bf06fa2b5b16f60da5095b5c/src/structures/ClientUser.js#L100-L107
https://github.com/discordjs/discord.js/blob/374c779f7f8bbaa9bf06fa2b5b16f60da5095b5c/src/structures/ClientUser.js#L130-L138
...

heavy crowBOT
heavy crowBOT
#
[discordjs/discord.js] branch deleted: fix/5990
heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
I don't know if this is an API issue or discord.js, please let me know if I should report it somewhere else.

When entering anything that's not a number id, the API times out, instead of throwing an error/ignoring the id.

Include a reproducible code sample here, if possible:

guild.members.fetch({user: ['202510746058358784', '330357883713748994', 'abcd']})

Output:

Error [GUILD_M...
heavy crowBOT
#

What is the difference between position and rawPosition? In issue #5379, it was stated that this could be a Discord API bug. However, I tried to reproduce this issue with the provided code and succeeded - even though it was stated that the Discord API bug would've been fixed by now (https://github.com/discord/discord-api-docs/issues/2640). However, all seems to work fine when using the channel#edit function.

heavy crowBOT
#

Previously this method would automatically include the bot scope - it's now required that the user provide scopes in the options, including one of either bot or applications.commands.

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 problem you are having in as much detail as possible:

When trying to remove a user's permissions from a channel, the api returns a 404 error.

Include a reproducible code sample here, if possible:

let channel = bot.channels.cache.get("channel_id");
channel.permissionOverwrites.delete("user_id");

Further details:

  • discord.js version: 13.0.0-dev.7e30011.1625338909
  • Node.js version: v14.17.1
  • Operating system: Windows 10 Pro
    ...
#
#

Before I noticed this issue I was under the impression it would be treated the same as an invalid ID, would be nice to let the developer know, but you are right; its not needed per say and the discord API should just respond with error code 400 or something instead of time out the application.

I guess I should wait for the discord developers to fix this issue. Thank you @iCrawl and @DTrombett for explaining!

heavy crowBOT
#

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

Replace this mess that is prone to errors and doesn't compose:

Structures.extend('Thing', Thing => {
  return class NewThing extends Thing {
    get getter() { ... }
    method() { ... }
  }
});

With this non-hacky, actually good practices, simple to understand:

function getter(thing) { ... }
function method(thing) { ... }

๐Ÿ”ฅ๐ŸŒถ๐Ÿ”ฅ๐ŸŒถ๐Ÿ”ฅ๐ŸŒถ๐Ÿ”ฅ

Status and versioning classification:
...

heavy crowBOT
heavy crowBOT
heavy crowBOT
#

I see how people can get mad at this, but I personally agree.
That said, I've been using structures, do as I say, not as I do

A library should not let its users touch to its own structures, because as @1Computer1 said it is likely for people to break stuff. One example, that doesn't run into the Structures case but still, is extending Client and overwriting Client#options. Many people came in the discord.js server to troubleshoot that weird infinite recursive call that makes node ...

heavy crowBOT
#

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

TypeError: newParent.permissionOverwrites.map is not a function error when calling the .setParent function

Steps to reproduce

  1. Create a new channel
  2. Try updating the parent (.setParent())

Include a reproducible code sample here, if possible:

import { OverwriteResolvable, Permissions, Snowflake } from "discord.js";

const DEFAULT_PERMS: OverwriteResolvable[] = [
        ...
heavy crowBOT
heavy crowBOT
#

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

I created an invalid embed message, where I tried to include a link on the title of a field. That apparently is illegal and both message.reply() and message.channel.send() errored from the API.

The problem was that this error was uncaught despite having them wrapped in a try-catch statement.

The error should bubble up instead of being uncaught.

Include a reproducible code sample here, if poss...

#

Your code snippet doesn't seem to align with the error provided.

Under normal circumstances the API would not error if you attempted to put masked link markdown in an embed field title - I just wouldn't render as a masked link.

Your error instead says that fields 1, 5, 9 and 13 failed Discord's validation because they were over 256 characters in length, a seemingly unrelated error. I also don't see any indication that this rejection was unhandled.

heavy crowBOT
#

๐Ÿ‘ Completely break commando and any bots that use Structures properly.

Sorry to break it for you, but you're a bit (+10 semver-major PRs) late, Commando doesn't work with v13 at all not even without this PR.

Also, it requires you to overwrite discord.js typings for your IDE to work with them properly, which I've never found a good thing to do (no matter what library we're doing that to).

I repeated this like a lot of times, you don't override types, you can't. The correct way ...

#

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

This PR allows fetching channels from guilds that do not exist in the client cache (applicable mostly when sharding, but also possible to have guilds uncached via intents limiting or the new collection based limiting)

A big red flag warning here: channels obviously rely on guild internally a lot, however I did not want to change types when the majority of times the values will be present. I would expect people us...

#

Please describe the changes this PR makes and why it should be merged:
This PR changes channel types from snake_case to UPPER_CASE to be more consistent with other types across the library and because we didn't have enough breaking changes already!

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 c...
heavy crowBOT
#
  • added GuildStickerManager (Guild#stickers)
  • added some methods to Stickers
  • added stickerCreate, stickerUpdate, stickerDelete
  • renamed GUILD_EMOJIS intent to GUILD_EMOJIS_AND_STICKERS

had to update APIRequest.json to get sticker creation working:

  • file.key will override file.name as the key in the FormData body, but file.name will stay the actual filename
  • options.dontUsePayloadJSON makes it send each data field separately in the body, instead of in one payload_json...
#

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

Did somebody order a pizza? Well, sorry to break it for you, it's another dish of breaking changes.

Barely any bot works untouched when switching from v12 to v13 and Sapphire is still unaffected, even by this.

Basically, the gist of this PR is that all instances of ID have been changed to Id, that includes resolveID -> resolveId, messageID -> messageId, channelID -> channelId, guildID -> `guild...

heavy crowBOT
heavy crowBOT
#

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

This PR adds failIfNotExists to ClientOptions. The reason why is: some devs may not want errors when the referenced message does not exist. Setting this option to false to every ReplyMessageOptions seems like a poor idea, easy to forget, so I added this option to ClientOptions.

Status and versioning classification:

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

https://github.com/discordjs/discord.js/pull/6027

Hello, I am writing here as a user of the structures and I agree that the structures should not be changed much but they should stay here. You are an open-source library so you should take a look from people as well. More people wanted the structures to stay but you changed them anyway. Structures also have a lot of advantages when, for example, you just want to get the prefix in your handler via .prefix instead of `.getGuildPrefix(guild....

#

Structures also have a lot of advantages when, for example, you just want to get the prefix in your handler via <guild>.prefix instead of <database>.getGuildPrefix(guild.id)

I see no advantage here, merely a preference.

It's especially better in that it's simpler and for npm packages when someone is doing a handler for example
Due to the destruction of the structures, npm packag developers will have to completely redo some things and it will be maximally more difficult for people...

heavy crowBOT
#

Structures also have a lot of advantages when, for example, you just want to get the prefix in your handler via .prefix instead of .getGuildPrefix(guild.id)

I see no advantage here, merely a preference.

It's especially better in that it's simpler and for npm packages when someone is doing a handler for example
Due to the destruction of the structures, npm packag developers will have to completely redo some things and it will be maximally more difficult for peo...

heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
Hi hi! Select menus, oh yeah.

Hey though, when I'm sending across nothing for a select menu, values is undefined.

At first I thought this would be a feature request, but when I looked at the data sent across for a CommandInteraction, an empty options Collection is present as well as the data sent over by the websocket doesn't include anything. I noticed discord.js nicely puts an empty `Collect...

#

You install a library that overrides a class's send method to add internal tracking for auto-editable messages, you also install a library that also overrides it to construct an extended version of MessagePayload so you can send other fields (that we don't support).

Which one would you be using? The one with auto-editable messages? Or the one with the extended MessagePayload?


Furthermore, Structures was always limited, there are structures we can extend, and structures th...

heavy crowBOT
heavy crowBOT
#

I don't see the issue with mutating the object and add those properties, it works fine, and I assume you can't even load them automatically because database interactions are usually asynchronous (and constructors synchronous).

Of course, you can always go for not storing that information in every guild and message, as that results on higher memory usage.

heavy crowBOT
#

I don't see the issue with mutating the object and add those properties, it works fine, and I assume you can't even load them automatically because database interactions are usually asynchronous (and constructors synchronous).

Of course, you can always go for not storing that information in every guild and message, as that results on higher memory usage.

Okay, thank you. And if I may ask, how do you plan to handle this in Commando? After all, that's also where you use the stru...

heavy crowBOT
heavy crowBOT
#

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

At first, we used module augmentation so the types could be linked with the actual library's types, however, that ended up not working correctly (and I suspect it's because the type definition, which unlike interfaces, they can't be augmented).

I moved the definitions into discord.js and prefixed them with Internal to not conflict with the /voice's definitions, as well as marked them as @internal with a descr...

heavy crowBOT
#

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

Closes #4274, I don't know why it isn't exported

Status and versioning classification:

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

Please describe the changes this PR makes and why it should be merged:
Fixes the typings for
Team#owner - the return type was missing null
Team#iconURL - the return type was missing null
TeamMember#toString - changed the return type to UserMention as for PR #6003

and changed the JSDOC for Team#ownerId to be type {?Snowflake} instead of {?string}.

Status and versioning classification:

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

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

Only TextBasedChannel#lastMessageId is given by Discord (data.last_message_id), User's and GuildMember's were extensions from our side.

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, pa...
heavy crowBOT
#

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

  1. improved library performance
  2. minimal breaking changes
  3. new features
  4. voice support
  5. well documentated https://abal.moe/Eris
  6. passed tests
  7. lightweight
  8. really flexible
  9. really up-to-date

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)
  • T...
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

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

  1. improved library performance
  2. minimal breaking changes
  3. new features
  4. voice support
  5. well documentated https://abal.moe/Eris
  6. passed tests
  7. lightweight
  8. really flexible
  9. really up-to-date

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (...
heavy crowBOT
#

There is still the issue with implicitly creating new instances of LimitedCollection through its methods, e.g. clone, filter.
TS will say those are LimitedCollections, but they actually are Collections.
(Creating new LimitedCollections is not possible without modifying Collection and thinking of a way to derive new arbitrary child instances)

I don't know of a way to make TS aware of Symbol.species and overwriting all methods to specify that actually a Collection is retu...

heavy crowBOT
#

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

  • โš ๏ธ remove Intents.ALL
  • โš ๏ธ remove Intents.PRIVILEGED
  • โš ๏ธ remove Intents.NON_PRIVILEGED

We currently provide static shorthands on the Intents bitfield wrapper (inspired by Permissions when implementing). This raises multiple issues:

  • End users are lead to just pass Intents.ALL no matter what they actually need for the bot to work, as evident from library support channels
  • Discord might change th...
heavy crowBOT
heavy crowBOT
#

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

This utility is useful for checking whether classes that use mixins don't get any unintended property.

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
heavy crowBOT
#

If you can still reproduce this on discord.js@dev please open a separate issue and provide the exact version (discord.js@13.0.0-dev.commithash.timestamp, you get this from npm list discord.js) and detailed steps on how to reproduce this issue, including the code you run in the format of a minimal, reproducible code sample.

If you think it's related to this issue feel free to mention that in the issue body.


Please provide a minimal reproducible code sample so we can attempt ...

heavy crowBOT
#

IMHO this is basically user error - we require users to always pass Snowflakes (numeric strings) to the entire library, and since members.fetch relies on on WS, it's a lot harder for errors to be caught.

If you want this error to not persist, we recommend you validate your user input, specially since Discord can restrict your bot's access to the API if it gets too many errors in a brief period of time.

#

Please describe the changes this PR makes and why it should be merged:
The bot invite scope was missing from the typings and from the docs.
The description of the bot scope on the docs might not be the best, let me know.

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
#

Readonly property "client" was missing from type definitions for class Presence.

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

Seeing as the client property is still being defined and is also still listed in the docs, this looks like it was missing. Feedback on PR is welcome, as I'd like to continue to contribute/do so properly. Thanks!

https://github.com/discordjs/discord.js/blob/master/src/structures/Presence.js#L41

**Status and versioning classifica...

#

as well as on Client#presenceUpdate

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

This PR:

  • removes User#presence as it was a hack traversing the guild cache in order to find a presence of any member representing the given user.
  • makes GuildMember#presence nullable. That way you can distinguish between "This member is offline" and "The presence of this member is unknown" without having to check the cache yourself, rendering this getter pointless.
    ...
#

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

This PR brings a bit of consistency to PresenceManager and Presence with the other structures and managers.
Presence more or less implemented Base's stuff itself in combination with PresenceManager patching it itself, while CachedManager could do that just fine.

Carefully going with semver: patch here, since I am not sure what making Presence extend Base could break.

**Status and versioning ...

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This PR changes the types for all spread arguments from unknown to any, introduced in #6047 basically meant that any conditions with these types would always return false (for example, partial channels)

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
#

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

Cus names conflict. Have fun reviewing.

Status and versioning classification:

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

I have recently installed discord.js via npm for a production level project. After installing discord.js and starting up server for first time, I get below error in terminal.

`node_modules/discord.js/src/sharding/ShardClientUtil.js:237
const shard = Number(BigInt(guildID) >> 22n) % shardCount;
^^

SyntaxError: Invalid or unexpected token`

When I remove the n from the equation at "22n", The error is corrected and the library works as ...

heavy crowBOT
#

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

This PR resolves some unreachable method overloads in some classes, which caused some type inaccuracies.

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
#

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

The force parameter is used only in line 88:

https://github.com/discordjs/discord.js/blob/2e078e44883c1ef5f85ef973d61a305ce2a34251/src/managers/ApplicationCommandManager.js#L88

Which is always unreachable for line 86, where this assignment is at.

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 ...
heavy crowBOT
heavy crowBOT
#

The bot enters and does nothing does not even give an error the piece of code to run the file is as follows:

var channel = message.guild.channels.cache.get("842859974324518913")
if (!channel) return console.error("The channel does not exist!");
channel.join().then(connection => {
const dispatcher = connection.play('./audios/private.mp3');
dispatcher.on("end", end => {
channel.leave();
});
});
and i dont understand beaucose, can help me everyone

heavy crowBOT
heavy crowBOT
#

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

Renamed Constants.OPCode for consistency with recent changes, also moved enum-like objects to the enums file and added tests to ensure they don't receive properties that shouldn't exist.

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 bre...
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This PR adds the type AllowedPartials for structures that can be partial. It also adds the support for partial reactions (the only partial structure without types) and changes how the Partialize type works (it should be only used by djs), so that it can easily extend partials structures.
Tests included!

Status and versioning classification:

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

Being honest here, I have used and abused structures to hell and forth since they were ever released in v12's master branch, I also personally use Message#send like @TwilightZebby has shown, however, as much as structures made our lives easier, they also carried a number of issues, from libraries being able to easily break our bots by assigning properties used by the library, to potential libraries taking advantage of this feature to register malicious code in bots without one knowing.

L...

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This PR just fixes an error in Typings where the option permissionId was types as permissionsId.

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
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Problem: I am trying to make a discord bot in VSCode with discord.js and I want it to respond to me if I say something but for it to not always be the same as the last time, here is an example,

me: Hello or Hi or Sup or Yo (case insensitive)

bot: Sup or Hello or Hi or Yo (case insensitive)

this is my code so far:

let repliesHi = [โ€œHiโ€, โ€œHelloโ€, โ€œYoโ€, โ€œSupโ€];
let randomHi = Math.floor(Math.random() * repliesHi.length);

client.on("message", message => {
if (/\bhi\b/...

heavy crowBOT
heavy crowBOT
#

call the random function inside client.on

let repliesHi = ["Hi", "Hello", "Yo", "Sup"];

client.on("message", message => {
	if (message.author.bot) return;
	if (/\bhi\b/i.test(message.content)) {
		let randomHi = Math.floor(Math.random() * repliesHi.length);
		message.channel.send(repliesHi[randomHi]);
	}
});

this way, each time the callback function for the message event is called, a new random number would be generated, instead of having it be generated one tim...

heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

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

Two patch methods, both private, second often gets missed during changes. No more!

Status and versioning classification:

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

call the random function inside client.on

let repliesHi = ["Hi", "Hello", "Yo", "Sup"];

client.on("message", message => {
	if (message.author.bot) return;
	if (/\bhi\b/i.test(message.content)) {
		let randomHi = Math.floor(Math.random() * repliesHi.length);
		message.channel.send(repliesHi[randomHi]);
	}
});

this way, each time the callback function for the message event is called, a new random number would be generated, instead of having it be generated one tim...

heavy crowBOT
heavy crowBOT
#

fix #6020

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

This PR fixes some jsdocs where shardId was showed as nullable while it isn't, in fact, passing null as shardId throws a TypeError. However, it's still marked as optional and types are ok.

Status and versioning classification:

  • This PR only includes non-code changes, like changes to documentation, README, etc.
  • Code changes have been tested against the Discord API, or there are...
heavy crowBOT
#

You can loop it and add the role thousands times

This seems like a very good way to reproduce the error - it's called a rate limit and it will prevent the API from responding, if not get your bot banned.

Please just stay focus on the issue we are trying to bring. It's already hard to get attention on it and we are dealing with this crap for years now. Adding roles manually because the discord API failed to grant them properly.
I obviously over reacted when mentioning "thousa...

#

Souji's comment was focused on this issue - he asked if you could reproduce it on the latest discord.js release.

If your focus is still on the role appearing in the client rather than the execution of API calls, then the issue doesn't appear to lie with discord.js, and you should follow this up with Discord directly.

Otherwise, I've just tried to reproduce this myself also, and we aren't able to with any of the code samples provided in this thread. If you still can on the latest `discor...

#

Well, what here is missing is a working example with a good circumstance. If you are sure that you're able to reproduce this bug (which actually doesn't seem to be related with djs itself) try adding a console.log(member.user.tag) at the start of the event, and if you see that a member doesn't receive the role, check that the console logged the user tag. If it wasn't, so most probably Discord didn't send the event.

heavy crowBOT