#Website

1333 messages · Page 2 of 2 (latest)

dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
#

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

Supersedes #8417

Introduces a generic structure implementation for the main lib (and others) to build on.

⚠️ This is currently in a very early proof of concept stage published as a PR to formulate ideas and solidify the intended structure (ha) of the module.

TODO:

  • [ ] Application
  • [ ] Audit Log
  • [ ] Auto Moderation
  • [ ] Channel
    • [x] Channels
    • [x] Mixins
      • [x] DM
      • [x] Guild
      • [x] Text
      • [...
dark summitBOT
dark summitBOT
#
export * from './ChannelOwnerMixin.js';
export * from './ChannelParentMixin.js';
export * from './ChannelPermissionMixin.js';
export * from './ChannelPinMixin.js';
export * from './ChannelSlowmodeMixin.js';
export * from './ChannelTopicMixin.js';
export * from './ChannelWebhookMixin.js';
export * from './DMChannelMixin.js';
export * from './GuildChannelMixin.js';
export * from './TextChannelMixin.js';
export * from './ThreadChannelMixin.js';
export * from './ThreadOn...
dark summitBOT
#

Which application is this bug report for?

Documentation

Issue description

In line 346, there is a duplicated word in the line "Specifies whether the message should be written to the the tool's output log". Note that the comment contains a duplicated word “the the”.

Steps to Reproduce

  1. Visit https://github.com/discordjs/discord.js/blob/main/api-extractor.json.
  2. Search using Command/CTRL + F or jump to line 346 to visit the comment "Specifies whether the ...
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
#

Which application is this bug report for?

Documentation

Issue description

The code example in the documentation uses import and top-level await:

import { REST, Routes } from 'discord.js';

await rest.put(...); 

This throws a SyntaxError unless the project is set up as an ES module, either by:

  • Adding "type": "module" in package.json, or

  • Renaming the file extension to .mjs

Even though the TOP they mentions "Node.js 22.12.0 or newer", that alone isn’t enoug...

dark summitBOT
#

As of version 22.7 node uses syntax detection and the example should run with a warning about re-parsing causing a performance overhead along with instructions on how to remove those [^1]. Accordingly, the recommended version 22.12.0 (though, really, people should generally use the recommended LTS) is beyond that point and should work as advertised.

(node:6378) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///Users/user/Documents/test/index.js is not specified and it doesn'...
dark summitBOT
#

👋Thanks for the quick response!

I did some deeper testing with Node.js v22.16.0 and I wanted to clarify why the example still fails for me (and likely others too):
Although Node 22+ supports auto module detection with a warning, it still throws a fatal SyntaxError when import is used at the top of a .js file without either:

  • "type": "module" in package.json, or
  • using a .mjs file extension.
    Even after adding a harmless line like console.log() above the import, Node shows th...
dark summitBOT
dark summitBOT
#

@almostSouji @Jiralite @Qjuh @millette

Yes, you guys are absolutely right — my package.json had "type": "commonjs", and removing it resolved the issue.

But I’d still suggest updating the example with a short note, because:

When someone runs npm init -y, the generated package.json defaults to "type": "commonjs", which causes this example to fail with a SyntaxError.

So for most users, running the example as-is in a new Node project still won't work unless they:

  • remove ...
dark summitBOT
dark summitBOT
#

Why not abstract? So classes that don't have any work to do here don't need to implement? Not sure I love that, we could go this route instead if we want to avoid empty implementations everywhere:

	protected _optimizeData?(_data: Partial<DataType>): void;

and calls do this._optimizeData.?(); (kMixinConstruct also follows this pattern)

(notice the lack of an abstract keyword, that actually requires explicitly specifying it in the subclass even if you don't want...

dark summitBOT
#

This method gets defined/overridden in the Mixin process. Making it optional instead of an empty function body would mean that every implementation of a Structure would have to do the optional chaining of that method call in their constructor. kMixinConstruct works completely different, as it's not a method that gets overridden but instead all of them get combined into a single function that gets called in the Structure base class here if present. Implementers don't need to worry about th...

#

Ideally substructures (which objects as properties technically are) would be cloned in their _toJSON() applied after this in the Mixin. When that happens the structuredClone of that object would be completely replaced/overwritten again and we have unneeded overhead. So the real question is if we want to rely on implementation always overriding in Mixin or extended class if there are substructures or if we want to go the safe (but less performant) route of always deep cloning (structuredCl...

dark summitBOT
#
dark summitBOT
dark summitBOT
#
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
wild tapir
#

Website

dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
#
dark summitBOT
dark summitBOT
#

Discoverability for one. It's also much worse DX.

There's basically 2 levels of end-user. The actual end-users, i.e. users of discord.js, and other libs extending structures, like discord.js itself will

Patch and clone I think would realistically only be used by the latter, which maybe justifies "hiding" them behind symbols. DataTemplate is meant to be used by the actual end users, and in my eyes is one of the selling points of /structures

dark summitBOT
#

This @ts-expect-error comment is actually suppressing 2 errors, one of which seems unexpected as it isn't related to the reasoning in the comment.

Moving the arguments into a new line reveals the second error, on the Object.assign() call, specifically the clone:

No overload matches this call.
  Overload 1 of 4, '(target: {}, source: Readonly<Partial<DataType>>): Readonly<Partial<DataType>>', gave the following error.
    Argument of type 'DataType' is not assignable to parameter...
dark summitBOT
#

I understand the idea, but that would mean that users implementing this would either

  • also do protected static override readonly [DataTemplatePropertyName]: ... making it same/worse than symbols
  • use protected static override readonly DataTemplate: ... and not match how it's written in the base class, which is also weird (and face the same issue if renamed)
    The purpose of the variables for DataTemplatePropertyName is merely to be used in the Mixin function, which is in another file....
dark summitBOT
#

If the exports you are describing do not exist, then discord.js would be totally broken as no API requests would be made and you would not be able to connect to the gateway. All hell would break loose in the support server (for years), but alas, nothing of the sort is happening. Things are not working out for you because of unknown reasons – you have not provided enough information to work with. You should head over to the support server and see how we can help.

A...

dark summitBOT
dark summitBOT
dark summitBOT
#
dark summitBOT
dark summitBOT
#

Which application is this bug report for?

Documentation

Issue description

In discord-api-types, we use the @unstable tag on several types to denote that a specific type, field, enum value, etc, is currently not fully documented, but does exist, and as such should not be relied upon. The djs docs website doesn't handle those tags quite nicely

Steps to Reproduce

Look at https://discord-api-types.dev/api/discord-api-types-v10/enum/UserFlags#Quarantined, then https://discord.js...

dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
#

Which application is this bug report for?

Documentation

Issue description

There's a bit of a discrepancy between the FAQ guides and the documentation and would love some clarification. I'm just confused as to where these get methods are being defined for roles, as the docs use fetch requests instead.

I see that interaction.options is defined by BaseInteraction. In the common use case of adding roles based on reactions, I don't think this works and you would need to use the `R...

dark summitBOT
dark summitBOT
dark summitBOT
dark summitBOT
#

Which application is this bug report for?

Documentation

Issue description

The documentation example for ContainerBuilder shows a method call:

.addComponents(separator, section)

However, .addComponents() does not exist in the discord.js builders API.

The correct methods are:

  • .addSeparatorComponents(separator)
  • .addSectionComponents(section)

This incorrect example appears in:
packages/builders/src/components/v2/Container.ts

This can confuse developers and cause TypeError...

dark summitBOT
dark summitBOT
#

Which application is this bug report for?

Documentation

Issue description

On the documentation page for EmbedBuilder, the extends BuildersEmbed link points to a 404 page.
Because of this, there is no accessible documentation for Embeds.

Steps to Reproduce

  1. Go to https://discord.js.org/docs/packages/discord.js/14.25.1/EmbedBuilder:Class
  2. Click on "extends BuildersEmbed"

Versions

  • Mozilla Firefox for Linux Mint 148.0.2 (64-bit)
  • Linux Mint (Cinnamon)

Issue ...

dark summitBOT
dark summitBOT
#

Which application is this bug report for?

Documentation

Issue description

Clicking on the link to various type properties leads to a 404 error on the docs. Searching for them also leads to a 404 error.

I have noted this down as a medium priority issue, as multiple pages of the documentation are completely missing. It does not seem particularly urgent but I believe it is more than a minor annoyance.

Steps to Reproduce

Example:

  1. Go to https://discord.js.org/docs/packages/dis...
dark summitBOT
#

Which application is this bug report for?

Documentation

Issue description

Currently, all the title says is "discord.js", the version number, and then "discord.js" again.
This is not helpful at all when using the browsing history or when you have several tabs.

It would be much better if there were, for example, User:class | discord.js (version), UserFlags:Enum | discord.js (version), etc.

I remember that this had already been an issue in the past, and it had been fixed, so th...

dark summitBOT
#

Not a maintainer, but the current website code seems to explain part of this.

In apps/website/src/app/docs/packages/[packageName]/[version]/[[...item]]/page.tsx, generateMetadata() parses the item path and then does:

const titlePart = decodedItemName.split(':')?.[0] ?? decodedItemName;

return {
  title: `${titlePart} (${packageName} - ${version})`,
};

So for a docs item like User:Class or UserFlags:Enum, the page title intentionally drops the :Class / :Enum part. The...