#archive-github-djs

1 messages ยท Page 4 of 1

heavy crowBOT
#
heavy crowBOT
heavy crowBOT
#

Is your feature request related to a problem? Please describe.
Having to provide the webhook id and token instead of just an url can result in more and less clean code which can be quite annoying.

Describe the ideal solution
A method overload that allows users to pass the whole webhook url:

  const webhookClient = new Discord.WebhookClient("https://discord.com/api/webhooks/12334567890/asddgsjhjhshfsjhefhshjfhsjfjehsjhf_ashdjhadjhwhja");

**Describe alternatives...

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This adds a required parameter to the getSubCommand() and getSubCommandGroup() methods, defaulted to true (as opposed to false in option getters), to allow for optional checking of sub-commands if needed (e.g. logging) without changing the current default behavior that enforces strict command definitions.

Status and versioning classification:

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

Please describe the changes this PR makes and why it should be merged:
The following classes were exported in the typings but not the index.js file:

  • ApplicationCommandPermissionsManager
  • CachedManager
  • ClientVoiceManager
  • DataManager
  • GuildInviteManager
  • StageInstanceManager
  • VoiceStateManager
  • WebSocketManager
  • WebSocketShard
  • AnonymousGuild
  • GuildPreviewEmoji
  • InviteStageInstance
  • InviteGuild
  • PartialGroupDMChannel
  • `StageIns...
#

Is your feature request related to a problem? Please describe.
No, this is an enhancement so there will be fewer people relying on private APIs that can change at any time.

Describe the ideal solution
When v13 releases, make private fields actually private (according to the spec, preface them with #)

Describe alternatives you've considered
Use TypeScript and private fields that way, but compiling to more recent versions would result in the same behavior, and it is t...

#

^ Some "private" properties aren't really private, per se; they are accessed internally by other classes. Since JS has no concept of friends, such properties can't be actually private. The best we could do for those properties is use a Symbol, but that isn't very elegant and is more trouble than it's worth IMO.

I do agree, however, that some properties should be switched to use actual private properties; just not all of them.

heavy crowBOT
#

That is indeed not mentioned, whats mentioned is:

For the embed object, you can set every field except type (it will be rich regardless of if you try to set it), provider, video, and any height, width, or proxy_url values for images.

https://discord.com/developers/docs/resources/channel#create-message-limitations

Still not sure why setting the width and height is not working

heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

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

message#channel still returns old TextChannel instance after change to news type channel

Include a reproducible code sample here, if possible:

  1. create a text channel
  2. make it a news channel (can be manual through GUI)
  3. get .channel inside this (now news) channel

observe: you get a TextChannel of type GUILD_TEXT
reason: https://github.com/discordjs/discord.js/blob/cd47a524afa9cd5af0dfe05d...

#

The most straight-forward and least hacky solution I can think of would be to make Message#channel a getter which retrieves this from cache instead. I can't find any reason so far why this would benefit from being a fix value vs. a getter

Alternatively this could be addressed by iterating over the message cache and setting the new channel to each message (though that seems to be quite the elaborate and hacky work-around)

#

Please describe the changes this PR makes and why it should be merged:
Just correcting the documentation for this type definition! It is an array - not a Collection.

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
#

ive found that when i run Guild.fetchAuditLogs() and pass the user property, neither actions that are executed by that user, or actions that target that user show up and i get an empty collection however if i omit that property and just pass the type, all of the executed and targeted audits for that user show up as well as the rest, should i create an issue? or am i doing something wrong? i have the correct intents enabled for the action and all partials enabled

heavy crowBOT
#

But you could also just store the URL somewhere in your code and parse the ID and token from the string to pass as arguments to the constructor instead of having to make the library handle it for the users.

I know that there a numerous options to solve this problem however I think that this small addition would make the life of a bunch of people notably easier. I also don't see a reason not to implement it.

heavy crowBOT
#

I've just copied and pasted your code:

  • action was "MESSAGE_DELETE"
  • The target id to check for was that of an author whose message I deleted
  • I added user: id to guild.fetchAuditLogs() - my id

The code ran and I see my result. Maybe in your case, there are just no results?

How about instead just doing something simple:

<Guild>.fetchAuditLogs({
  user: "id"
}).then(console.log);

If you see the results you expect here from the executor, then the error ...

heavy crowBOT
#

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

Upon running .fetchAuditLogs({ type }) where type is 40 (INVITE_CREATE), 41 (INVITE_UPDATE) or 42 (INVITE_DELETE), there is a possibility that target on the returned GuildAuditLogsEntrys will be undefined.

One case where this is easily reproducible is by simply creating and then deleting an invite and then running .fetchAuditLogs({ type: 40 }).

I've simply added the nullish coalesc...

heavy crowBOT
heavy crowBOT
#

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

Sets thread auto archive to 0 when not sent in a paylod (exception for interactions)

closes: #6151

Also Fixes docs and typings for ThreadChannels

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

Another common pitfall that sometimes comes up in our support channels is that people run multiple processes and applications on the same token. Due to how presence update distribution is handled this will conflict and can cancel each other out, or simply not apply any at all. This use case is not supported, each application should run on it's own token, as they share rate limits and other information.

heavy crowBOT
#

No, this isn't available for use without being whitelisted.

This adds support for creating Application Commands in right-click context menus, and receiving the interactions.

The received data is parsed into the CommandOptionResolver as seamlessly as possible:

  • A command acting on a user creates a USER type option: getUser('user) / getMember('user')
  • A command acting on a message creates a fake _MESSAGE type option for the new getMessage('message')

The type of applicat...

heavy crowBOT
heavy crowBOT
heavy crowBOT
#

@Poly-Pixel With the current codebase, yes this can be done using an external library. The way I'm approaching it is I'm overriding the api property of the client:

// Something like this
import {Client} from 'discord.js'
import type {Snowflake} from 'discord.js'

const api = {
  guilds: (id: Snowflake) => ({
    // fetch guild
    get: async () => ({
      id,
      name: 'blah',
      // ...
    })
}

class MockedClient extends Client {
  constructor(options) {
  ...
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This exposes the https.Agent options object for APIRequest as a client option (HTTPOptions#agent?: https.AgentOptions). I am currently working on mock integration testing for discord.js applications, involving a mock REST API and gateway, but to work with a local server and x509 certificates, it is necessary to change some agent options (rejectUnauthorized: false).

Status and versioning classification:...

heavy crowBOT
#

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

InteractionResponses did not document a few fetchReply properties to the methods, so I've gone ahead and added those in.

The documentation for the type definition InteractionDeferUpdateOptions was completely missing, so I've added that in too!

I also noticed that the .update() method documented WebhookEditMessageOptions to be sent across. This didn't include the fetchReply property, but I did...

heavy crowBOT
heavy crowBOT
#

Seeing as the original issue (#727) was closed over a year ago (with no real conclusion to the issue), and unit testing is still a hassle to implement, I'm opening this issue.

Describe the ideal solution

The ideal solution would be for snippets like the one below to simply work:

import {Guild, TextChannel, Message} from 'discord.js';
import {MockClient} from 'discord.js/mock';
const client = new MockClient();
const guild = new Guild(client, {});
const channel =  new T...
#

Create a testing server (save the server id and channel id) and make a function that will run any command with the specified args passed. Run all variations of the command on the testing channel and assert that the last message sent was correct.

Don't test more than one command at a time because sending too many messages is api abuse. But if you want a method of testing your discord bot, that is how I do it.

#

Well if testing was done by actually making a client login & performing the testing there, there can be API spam as pointed out by @Tenpi but also inconvenience. It would be slow & you may actually need to alter the source code to be able to test it which I don't think is a good thing.

As to how the dummy data will be gained,

new Discord.MockUser(userProperties: UserPropInterface = DefaultUserProp): MockUser
new Discord.MockChannel(channelProperties: ChannelPropInterface = Default...
#

Updated @TotomInc example for v12

<details>
<summary>Click to expand code</summary>

import {
    Client,
    Guild,
    Channel,
    GuildChannel,
    TextChannel,
    User,
    GuildMember,
    Message,
} from "discord.js";

export default class MockDiscord {
    private client!: Client;
    private guild!: Guild;
    private channel!: Channel;
    private guildChannel!: GuildChannel;
    private textChannel!: TextChannel;
    private user!: User;
    priva...
#

due to managers being recreated on each call to things like member.roles, I'm unable to stub out add:

const Discord = require('discord.js');
const sinon = require('sinon');

let client = new Discord.Client();
let guild = new Discord.Guild(client, {id: Discord.SnowflakeUtil.generate()});
let user = new Discord.User(client, {id: Discord.SnowflakeUtil.generate()});
let member = new Discord.GuildMember(client, {id: Discord.SnowflakeUtil.generate(), user: {id: user.id}}, guild)...
#

A little bit off topic, but I came here wondering how to mock Discord bots with ts-jest. I used a mix of this excellent comment (https://github.com/discordjs/discord.js/issues/3576#issuecomment-633255658) and this one (https://github.com/discordjs/discord.js/issues/3576#issuecomment-755077752) to mock this working code out:

describe("Bot", () => {
  it("executes the help command", async () => {
    let discordClient = new Discord.Client();
    let guild = new Discord.Guild...
#

Does someone have a fix for this error without using --forceExit in jest? Maybe @mirkoRainer or @TotomInc?

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  โ—  Timeout

      78 |
      79 |   private mockClient(): void {
    > 80 |     this.client = new Client();
         |                   ^
      81 |     this.client.users.fetch = jest.fn(() => Promise.resolve(this.getUser()));
      82 |     this.client.login = jest.fn(() => Promis...
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Interesting. It looked like it ran tests via the included CLI ๐Ÿค”
A message-based testing library doesnโ€™t seem very useful to run slash commands against. It doesnโ€™t look like there are very many options out there either. I had the idea that one could use the Collections feature to create a mock server, filling it with data using something like faker.js? I havenโ€™t pursued that idea very far though.

heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
Currently, you can fetch a guild's widget data with Client#fetchWidget(guild), but you can't do it from the guild object. Now, you can use Guild#fetchWidget() as a shortcut. The old fetchWidget and setWidget methods have been renamed to fetchWidgetSettings and setWidgetSettings to more accurately explain their functionality.

Status and versioning classification:

  • Code changes have been tested against the Disc...
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
Can't fetch members by role since member.roles.cache throws an UnhandledPromiseRejectionWarning. The get cache getter in GuildMemberRoleManager tries to load the everyone role from cache although it might not be present, resulting in a consecutive TypeError.

(node:24824) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
    at GuildMemberRoleManager.get cache [as cache] ...
heavy crowBOT
heavy crowBOT
#

I don't think that adding a transform option is needed, it would make it just more difficult to understand how it works.

It could also be an option passed to the client? this way it wouldn't be a breaking change
There are already so many breaking changes in v13, another one would not make the difference.

Would it be a good idea to just make the types more digestible? Is there a reason to follow the names of the API?

heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

I'm not sure this is a bug.

Without the GUILDS intent specified, the gateway doesn't send any GUILD_CREATE packets. This means that guilds are only sent to us in the form of an id on the READY packet, which means we straight away don't know anything. We cannot really create anything in this case. Perhaps we could add in the RoleManager#cache the id of the @everyone role, but we would know pretty much nothing about it.

You could force a fetch to Discord's API when you fetch a g...

#

It just feels uninutive. I have the GUILD_MEMBERS intent and I am trying to filter guild members based on their roles. It is non-obvious to me, as a developer, that to filter the roles of members, I would need to fetch the everyone role for the guild just for the code not to throw an exception.

If the everyone role is unavailable if I don't have the GUILD intent, then it should at least work for the other roles (since as IMRody noted, filtering for Everyone would make little sense anyw...

heavy crowBOT
#

The above code did work without having to fetch the everyone role for the guild in v12 and judging from the answers people get on discord about filtering members by role, no one else is aware that fetching the guild roles is required now, either.

That's odd, I'm actually getting the same error on 12.5.3 (stable):

/Users/jiralite/Documents/GitHub/DTT/node_modules/discord.js/src/managers/GuildMemberRoleManager.js:32
    return this.guild.roles.cache.filter(role => this.member._roles...
heavy crowBOT
#

It just feels uninutive. I have the GUILD_MEMBERS intent and I am trying to filter guild members based on their roles. It is non-obvious to me, as a developer, that to filter the roles of members, I would need to fetch the everyone role for the guild just for the code not to throw an exception.

Nothing about this unintuitive. No guild packet = No roles. Roles don't exist outside of a guild. Specifying GUILD_MEMBERS means you get the members with the applied roles, but no information abou...

heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
Implements the changes described in #5672. This changes Util.fetchRecommendedShards to take in a FetchRecommendedShardsOption which includes guildsPerShard which is the number of guilds per shard the user wants and a boolean largeBotSharding option which decides if discord.js will round their shards up to a multiple of 16 which is [required for large bot sharding.](https://discord.com/developers/docs/topics/gateway#sh...

heavy crowBOT
#

imo it's a bad idea to stick the target information into options; currently context cmds can't have options but they might add support in the future, and also it's not really good ux to just make fake options. it would be better to have dedicated target properties; maybe interaction.target.id, interaction.target.message, interaction.target.user, and interaction.target.member?

heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
if i try to get the user status as online or dnd or idle or offline it always gives offline for users
Include a reproducible code sample here, if possible:

const user = message.mentions.users.first() || message.author;
console.log(user.presence.status);

Further details:

  • discord.js version: 12
  • Node.js version: 16.5
  • Operating system: windows 10
  • Priority this issue should ...
heavy crowBOT
#

We can default to 16 but should allow passing any arbitrary number in case this requirement ever changes.

Okay, so assuming the FetchRecommendedShardsOption stays we can either simply add a largeBotShardMultiple like:

guildsPerShard = 1000
largeBotSharding = false
largeBotShardingMultiple = 16

Or just ditch the largeBotSharding option entirely by replacing it with a multiple

guildPerShard = 1000
roundToMultiple = 1 (and state in the documentation it needs to be set...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This PR adds a setFields method to MessageEmbed that works similarly to addFields but it overwrites the current fields in the MessageEmbed.

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

Please describe the problem you are having in as much detail as possible:
so i'm trying to use discord.js master with express to make a api which shows whatever i want , lets say client.users.cache.get(myID).avatarURL() , but thing is it doesn't cache , only when i run the command on Discord it shows , when i do client.users.cache.size it shows 3 out of 180k users , it doesn't make sense , my caching option thing is this

makeCache: Options.cacheEverything()
```  below co...
#

users only get cached when the bot gets the user in a Discord gateway event or API response. users cant just get cached out of nowhere; you should fetch them.

Yes , you're right , talking about fetching , this should cache all users?

client.guilds.cache.forEach(guild => {
  guild.members.cache.forEach(member => {
    if(member.user.bot) return
    console.log(member)
  })
})

or by fetching you mean in different way? Maybe i'm doing wrong , but i'm cached only when ...

#

the code you sent doesn't contact Discord at all so it won't really do anything

you can fetch a user with await client.users.fetch(id), see docs

it's working when you send a message in Discord because discord.js receives the message event from Discord, which includes your user object, and it gets cached from there.

oh fair enough , but what about not being able to run express when i've set up sh...

heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
Trying to shard my bot again , but this thing shows up and i have no clue of why , not much i can give as details , but i can answer questions if you know solution.
Include a reproducible code sample here, if possible:

MANAGER.JS

const { ShardingManager } = require('discord.js');

const manager = new ShardingManager('./index.js', { 
    token: 'NzQ5NTYzMTYzMTkxNTQxODAx.X0tzGA.-_e-LWGV_kV6...
heavy crowBOT
heavy crowBOT
#

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

Everyone knows that v13 brings a lot of breaking changes, but some of those are more problematic than others.
We can do without Structures (it's a huge pain in the ass but it's better for everyone), a naming convention can be replaced, but types that can be stored to be referenced like channel types are more difficult.

For all bots witch were used before this v13, a disgusting think like that is needed.

const co...
#

You haven't explained at all what exactly this is needed for - I'm going to guess something like having these old type values stored in a database?

Run an update.

update channel_table
set type = 'GUILD_TEXT'
where type = 'text';

Or maybe you use mongo

db.collection('channel_table').updateMany(
  { type: 'text' },
  { $set: { type: 'GUILD_TEXT' } }
);

Or use your little object map.

The change was not breaking just for the sake of breaking - it makes th...

heavy crowBOT
#

For example, I would use my personal case, a backup feature, which stores desired data of servers to restore differences between the actual version and the backup when it's asked by a user.
when I was doing the backup, the data of channels were formatted into simples objects, then it was stringified and stored in my database (SQLite in 2017 so no JSONb type).

The "magic string" was given by discord.js himself.
...

heavy crowBOT
#

I know it's way too late but I'm just seeing this now and I figured I'd mention that it's more than just being the same as other discord bot libraries.

What about people with databases? They've probably stored a few structures as userID or guildID by now. The toJSON method obviously used to use ID instead of Id, and people have definitely used that for storing or sending json. So having the keys change could cause some confusion.

Changing all instances of a function like resolveID to resolv...

#

What about people with databases? They've probably stored a few structures as userID or guildID by now. The toJSON method obviously used to use ID instead of Id, and people have definitely used that for storing or sending json. So having the keys change could cause some confusion.

The same as #6189 - your fault for not sanitizing values and instead relying on whatever discord.js gives you (which by the way, is extremely inefficient storage wise).

If I were you and I stored data from D...

heavy crowBOT
#

Perhaps I didn't do a great job at explaining the problem I see with this change.

I definitely don't just throw random objects into my database, although I'm not sure if I can speak for everyone.
However, I do store specific keys, the ones that I need, and most of them are IDs. So obviously, seeing as discord.js uses ID, it would only make sense to do so too, right?
So now you've saved millions of documents with ID but you've gotta switch up your code to use Id in some places and ID in other...

heavy crowBOT
#

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

This allows WebhookClient's to be made with URLs, without the need of removing it or doing any type of parsing. This is useful for pass-through services like Webhook senders, etc., allowing a more convenient time for developers who don't want to use IDs and tokens. Example:

import { WebhookClient } from 'discord.js';

const webhook = new WebhookClient({ url: 'https://discord.com/api/webhooks/1234567890/a...
heavy crowBOT
#

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

Guild wide route for fetching active threads! And since its being removed in v10, already based the per channel fetch on that.

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

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

Audit Logs are fun, I don't use them so my testing may have missed something.

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

// The bug report is not for code

Further details:

  • discord.js version: 13.0.0-dev.fe6cc0c.1625227356
  • Node.js version: v14
  • Operating system: Cloud platform
  • Priority this issue should have โ€“ please be realistic and elaborate if possible: Everytime my app is been built, I get `npm WARN deprecated discord-api-types@0.1...
heavy crowBOT
#

I want to know the client user language to be able to send a response with my bot in the user language. I have found in the documentation that it is possible to do that with locale property : https://discord.js.org/#/docs/main/stable/class/User?scrollTo=locale I know that could be null. Even though I have set my language parameters, I still get a null response from the API.

client.on('message', async msg => {
    if (msg.content.startsWith('!testlang')){
        console.log(msg.au...
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
The typings and documentation both detailed a Snowflake to be used for GuildInviteManager#cache and GuildInviteManager#fetch() instead of a string (invite code). This pull request should resolve this!

Resolves #6199 also.

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

Please describe the changes this PR makes and why it should be merged:
discord.js uses "subcommand" and "sub-command" in several places in the codebase (including the documentation). This pull request will change all instances of "sub-command" to "subcommand" (and "sub-command group" to "subcommand group", but there wasn't any). The reason why "subcommand" has been chosen to be preferred was because Discord [documents it as "subcommand"](https://discord.com/developers/docs/interactions/s...

#

I have noticed recently that the activity status on my bot has been suddenly disappearing. Im not entirely sure why this is, but I've noticed it seems to disappear around 24 hours after the client logs in. Here is the code Im using to generate the Activity status:

client.once('ready', () =>{
    client.user.setActivity("The time...", {
        type: "WATCHING"
    });
})

Which from what I have read, is the correct way to do it.
The Bot is running the following

  • NodeJS versi...
#

Please describe the changes this PR makes and why it should be merged:
This PR adds an owner getter that returns a ThreadMember object corresponding to the owner of the thread and a fetchOwner() method that returns the GuildMember object corresponding to the Owner of the thread, since Discord doesn't allow us to fetch single thread members.

Status and versioning classification:

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

This documents the exported and separately documented typedef values in util/Constants.js as one parent object, covering all of the ones that can be used in an enum-like way, e.g. Constants.MessageButtonStyles.PRIMARY. As discord.js doesn't export the TS enums in its packages typings, this alternative allows us to support the usage of Constants instead of relying on magic strings.

I'm not sure if I've done it correctly, since this definition is referencing the enum/object/whatever of a...

heavy crowBOT
#

Is your feature request related to a problem? Please describe.
When working with embeds, I need to repeat dynamic: true in every avatarURL(), displayAvatarURL(), iconURL() etc to make gifs work
Describe the ideal solution
It could be adding a new property to ClientOptions which would allow anyone to override this behavior
Describe alternatives you've considered
Simply, changing default value to true, but it'll make every icon, avatar etc animate, which some people...

heavy crowBOT
#

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

With discord buttons and link button components, there are certain property combinations that aren't allowed. Basically, You can't use a customID property for buttons with the LINK style, for non-link buttons you can't use the url property. The issue is that it is only presented at runtime:

DiscordAPIError: Invalid Form Body
components[0].components[0].custom_id: A custom id and url cannot both be spe...
heavy crowBOT
#

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

Fixes a bug where #thread is null after a message update because it does not contain the thread data, relying on thread create instead.

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

I found the some solution

  async send(options) {
    const User = require('../User');
    const GuildMember = require('../GuildMember');

    if (this instanceof User || this instanceof GuildMember) {
      return this.createDM().then(dm => dm.send(options));
    }

    let messagePayload;

    if (options instanceof MessagePayload) {
      messagePayload = options.resolveData();
    } else {
      messagePayload = MessagePayload.create(this, options).resolveData();
  ...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
Because messageCreate fires twice per send if the bot sends it when cache size of MessageManager is Zero.
This PR fix that problem.

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 changes this PR makes and why it should be merged:
Because messageCreate fires twice per send if the bot sends it when cache size of MessageManager is Zero.
This PR fix that problem.

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:

Fixes the name of the typedef for Constants.StickerTypes.

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:

This PR fixes a bug that causes invalid permission flags to be reported back as undefined
e.g.

channel.permissionOverwrites.edit(role, {
    FOO_BAR: true,
});

Would throw this error: RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.

With this PR it will throw: RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: FOO_BAR.

**Status and versioning cl...

#

Please describe the changes this PR makes and why it should be merged:
The method no longer exists (and/or bots don't have access to it)

DiscordAPIError: 405: Method Not Allowed

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
  • This PR includes breaking changes (met...
#

Please describe the changes this PR makes and why it should be merged:
The type definition for the GuildTextChannelResolvable in the documentation was missing, so I've gone ahead and added it in!

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, REA...
#

I'd be careful here; With the current iteration of context menus this might heavily clash with them.

They are application commands and still share the same permission.

@iCrawl true, but with that in mind I think Discord will either prepare more permissions, or clear things up - for now, it's officially USE_SLASH_COMMANDS, and that's how it should be shipped ยฏ_(ใƒ„)_/ยฏ

#

Please describe the changes this PR makes and why it should be merged:
WelcomeChannel#guild's return type should be either a Guild or an InviteGuild. WelcomeGuild was incorrectly documented here!

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

Please describe the changes this PR makes and why it should be merged:
The property defaultMessageNotifications on GuildCreateOptions used the DefaultMessageNotifications type definition, but it should be using instead the DefaultMessageNotificationLevel type definition or a number.

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

Please describe the problem you are having in as much detail as possible:
Outdated links in the Client-Object

 http: {
       version: 9,
       api: 'https://discord.com/api',
       cdn: 'https://cdn.discordapp.com',
       invite: 'https://discord.gg',
       template: 'https://discord.new'
     }

I'm not sure what links would be the right links foir api and cdn.
But invite leads to discord.com and api and cdn just lead to Err...

heavy crowBOT
heavy crowBOT
#

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

Describe the ideal solution
There is no way to track the invitations currently. It gives the number of times the invite was used only.. But that could be just users joining the server and leaving in 1s.

I am looking for the proper invite tracking bot and could not find it.

All I am looking is for the member obj returned from the guildMemberAdd and guildMemberRemove events to include the joined invi...

heavy crowBOT
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This pull request tweaks some @returns descriptions that I have judged... strange.

When I was looking through the documentation for a GuildEmoji, I noticed the GuildEmoji#equals() method had a @returns description on it. I also noticed the description is quite literally the same as the initial description. So like, why is it there? This is the sa...

heavy crowBOT
#

Let's imagine a situation. We have a Discord bot that doesn't have access to the Message Intent. Ordinary commands cannot work accordingly. The only good way out of this situation is with a slash from the Discord command. It seems that everything is fine, but what if the bot developer needs to register all commands by servers, and not globally, for example, so that the command descriptions are adjusted to the server language of the bot itself. So that let's say on American servers there was...

#

I thought that the library itself sets this limit. It turns out this is the limit of the Discord API itself. It's a pity. It's just that for me personally, this will be a very serious problem, tk. my bot has 142 commands and it is not known if I will have access to the Message Intent. I have been unable to access GUILD_PRESENCES for almost a year now, and here's a new intent (

heavy crowBOT
heavy crowBOT
#

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

The long awaited move is here.
Also comes with a bug fix to the method (throws properly when a role is invalid), along with no more param manipulation.
Further adds a force param for those of you that don't get member events (if a member has left while the bot is running, they still are cached ๐Ÿ˜ข )

Status and versioning classification:

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

Please describe the changes this PR makes and why it should be merged:
Per #5521, methods and typings that were solely for category channels (and ids) were instead allowing any channel to go through instead of just CategoryChannelResolvable. This pull request should address this and resolve #5521.

Additionally, this pull request changes the type definition for ChannelData. Before, it only could take the parent id (Snowflake) of a potential category channel, but now, it is possib...

heavy crowBOT
heavy crowBOT
heavy crowBOT
#

I noticed there's a bunch of other places where the typings can be strengthened, so I'm going to add the following and apply them to hopefully everywhere with no missed instances:

  • @typedef {TextChannel|Snowflake} TextChannelResolvable
  • @typedef {VoiceChannel|Snowflake} VoiceChannelResolvable
  • @typedef {VoiceChannel|StageChannel|Snowflake} GuildVoiceChannelResolvable
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
heavy crowBOT
#

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

ref: https://github.com/discord/discord-api-docs/pull/3542

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

Please describe the changes this PR makes and why it should be merged:
This PR changes the version number format of dev builds to be alphabetically sortable by putting the timestamp first, followed by the commit SHA.

This should address issues with yarn outdated caused by version numbers that aren't compliant with semver (yarnpkg/yarn#3560).

This also corrects the version number to be compliant with semver.

A t is prepended to the timestamp of the version to ensure it sorts ...

#

data: index.js:18319 - /home/debian/tembot/node_modules/discord.js/src/util/Collection.js:6
data: index.js:18319 - class Collection extends BaseCollection {
data: index.js:18319 - ^
data: index.js:18319 - TypeError: Class extends value undefined is not a constructor or null
data: index.js:18319 - at Object. (/home/debian/tembot/node_modules/discord.js/src/util/Collection.js:6:26)

I believe this maybe because of https://github.com/discordjs/di...

#
[discordjs/discord.js] New branch created: chore/deps/discord\-api\-types\-0\.21\.0
#

Please describe the changes this PR makes and why it should be merged:
This PR removes the hardcoded dev version for npm deprecate and removes the t from the version number.

  • This PR should only be merged once version >= 13.0.1 has been published to npm as the latest version so that ordering doesn't break.

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 change...
#
[discordjs/discord.js] branch deleted: chore/deps/discord\-api\-types\-0\.21\.0
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This PR add the message property to the interaction class

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

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

An error is thrown about missing FinalizationRegistry type

Include a reproducible code sample here, if possible:

const client = new Discord.Client({
  intents: [
    Discord.Intents.FLAGS.GUILDS,
    Discord.Intents.FLAGS.GUILD_MEMBERS,
    Discord.Intents.FLAGS.DIRECT_MESSAGES,
    Discord.Intents.FLAGS.GUILD_MESSAGES,
  ],
});

Further details:

  • discord.js version: 1...
#

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

We want to able to keep things indefinitely in limited/swept caches, so might as well just merge the two since the only difference then is the sweeping.
Also "fixes" some typings (TS sucky wucky).
Probably didn't rename everything, 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 ha...
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This fixes #6236 which was caused by the @discordjs/collections being deconstructured when importing.

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 changes this PR makes and why it should be merged:
This changes the Message#startThread parameters to be consistent with ThreadManager#create to also prevent the need for any breaking changes in the future if extra parameters need to be added.

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

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

Depends on https://github.com/discordjs/collection/pull/44. Removes usage of Util.flatten on entries that do not have toJSON.

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:

Discord outlines that some combinations aren't valid in application command options.

choices?: choices for STRING, INTEGER, and NUMBER types for the user to pick from
options?: If the option is a subcommand or subcommand group type, this nested options will be the parameters

This PR makes any options not adhering to the cause a compile time error. I didn't put too much thought into naming some of the ...

heavy crowBOT
heavy crowBOT
#
gc

Please describe the problem you are having in as much detail as possible:
I did some profiling of my bot, and found DJS doing quite a large amount of cpu work here:

I did a couple checks, and this is called many times, for example every time I add a reaction to a message, because those classes (e.g. Message, MessageReaction, ReactionCollector) will access client.emojis.resolveEmoji() or something like that. From my reading of the code it looks like its generating a new cache ever...

heavy crowBOT
heavy crowBOT
#

Probably needs to be done this way? fetchWhenExisting defaults to true, so we need to check for a required false value, then the rest of overloads.

  public add(user: UserResolvable, options: AddGuildMemberOptions & { fetchWhenExisting: false }): Promise<GuildMember | null>;
  public add(user: UserResolvable, options: AddGuildMemberOptions): Promise<GuildMember>;

You can also add a type test.

#

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

I updated the library from v12 to v13-dev to check the new features and I find a bug with the member colors.
First the console returned me TypeError: member.roles.cache.array is not a function so I thought that in this version, the function member.roles.cache.array was deprecated, then I replaced it. After that, the console returned me TypeError: sorted.array is not a function and when I commented the line...

#

Please describe the changes this PR makes and why it should be merged:
Since we are using application commands instead of message based commands for all examples, the readme should do it too for consistency

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

Please describe the changes this PR makes and why it should be merged:
This changes VoiceState#kick() to VoiceState#disconnect().

Changing it to use disconnect reflects well on descriptions elsewhere such as VoiceState#setChannel() and GuildMemberEditData and the Discord documentation. Even in the Discord client when you right click someone, the option is "disconnect". I feel like this is a consistent c...

heavy crowBOT
#

This doesn't work as a default...yet, but brings up the point that these don't work at all right now. Fixes below

<details>
<summary>Diffs</summary>
In CachedManager:

- Object.defineProperty(this, '_cache', { value: this.client.options.makeCache(this.constructor, this.holds) });
+ Object.defineProperty(this, '_cache', { value: this.client.options.makeCache(this.constructor, this.holds, this.client) });

in Options.cachewithLimits:

- return manager => {
+ ...
heavy crowBOT
#

Unsubscribe

On Sat, Jul 31, 2021, 16:39 Noel @.***> wrote:

Merged #6246 https://github.com/discordjs/discord.js/pull/6246 into
master.

โ€”
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/discordjs/discord.js/pull/6246#event-5094269165, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AUZF5TJIW7Y34BRRJ3OAQ73T2PKWLANCNFSM5BJSNL5A
.

heavy crowBOT
#

I attempted to ask on the discord with no response. I do not want to create an issue in case I am wrong. However, this used to work on v12 and appears it has not been changed from what I can tell.

Using roles.highest on a member used to return the highest role of that member, @dev from about 12 hours ago just gives an error.

const guild = client.guilds.cache.get(`GUILDIDHERE`);
let member = guild.members.cache.get('USERIDHERE');

console.log(member.roles.cache); //properly works...
heavy crowBOT
#

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

This PR modifies GuildChannel and BaseGuildVoiceChannel to use Collection#filter for their respective members getters. I have troubles understanding why they've been written this way, even tho they are basically filters under the hood.

Also removes the administrator permission ignore from GuildChannel#members, not sure why this was set? If someone has got Administrator permission, even if they don't hav...

heavy crowBOT
#

i think this is implemented in discord-api-types, have you looked at that?

So I do see that it's implemented there, however I've never used discord-api-types, and I'm unsure how to use it's typings with discord.js's typings, because the types conflict. I'm probably missing something here, but can I use discord-api-types with discord.js?

heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
The topic property and setTopic function are both located in the GuildChannel class, despite them only existing in text-based channels like TextChannel and NewsChannel. I would open a PR to move these, however, there are functions in GuildChannel that depend on the topic and I'm not sure how to handle those.

Since this can't really be reproduced with code I have removed that part of the template.

**Fu...

heavy crowBOT
heavy crowBOT
#
    return this.guild.members.cache.filter(m => this.permissionsFor(m).has(Permissions.FLAGS.VIEW_CHANNEL, false));

This doesn't do what it sounds like, it's very confusing. The reason this exists is because the api lets you overwrite the administrator permission on channel, however, it does not do anything, meaning it needs to be ignored. If you have admin from a role, it automatically sets all permissions to true so the administrator check is a noop for that too.

heavy crowBOT
heavy crowBOT
#

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

fixes collection import, no more chance of circular dependency either, so moved the import to the top

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:
The response methods did not correctly reflect the typings on @returns, so I've gone ahead and corrected them!

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
#
[discordjs/discord.js] New branch created: chore/deps/discord\-api\-types/0\.22\.0
#
[discordjs/discord.js] branch deleted: chore/deps/discord\-api\-types/0\.22\.0
#
[discordjs/discord.js] New branch created: chore/deps/@discordjs/builders/0\.3\.0
#
[discordjs/discord.js] branch deleted: chore/deps/@discordjs/builders/0\.3\.0
heavy crowBOT
heavy crowBOT
#

Please describe the problem you are having in as much detail as possible:
I want to use the ClientApplication.owner property for permissions check on my bot, problem : on fresh bot as on old, team-managed bot, it always seem to return "null"

Include a reproducible code sample here, if possible:

const DISCORD = require("discord.js")
const client = new DISCORD.Client() // in my actual code there was intents declared
client.login(token)

console.log(client.application.o...
heavy crowBOT
heavy crowBOT
#

Please describe the changes this PR makes and why it should be merged:
This PR Changes the typings for the data variable inside ApplicationCommand. As of now, it requires RawApplicationCommandData, which is the incorrect type. This fixes that by reverting to the ApplicationCommandData type.

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating
heavy crowBOT
#

This addresses a number of issues with various channel properties being defined too generically, resulting in them existing on channel subclasses where they aren't supported by the API.

Changes

  • New class BaseGuildTextChannel extends GuildChannel, implements TextBasedChannel
  • TextChannel and NewsChannel both extend BaseGuildTextChannel
  • rateLimitPerUser now only exists on TextChannel
  • GuildChannel#setTopic moved to BaseGuildTextChannel
  • GuildChannel#createInvite moved to Ba...
heavy crowBOT
heavy crowBOT