Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rateLimitInfo.requestLimit is undefined #3131

Closed
1 task
niekcandaele opened this issue Mar 7, 2019 · 3 comments
Closed
1 task

rateLimitInfo.requestLimit is undefined #3131

niekcandaele opened this issue Mar 7, 2019 · 3 comments

Comments

@niekcandaele
Copy link

niekcandaele commented Mar 7, 2019

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

When trying to log info about the rateLimit event, rateLimitInfo.requestLimit is undefined.

Include a reproducible code sample here, if possible:

client.on('rateLimit', info => {
    console.log(`Discord API rateLimit reached! ${info.requestLimit} max requests allowed`);
});

Which results in this log line: Discord API rateLimit reached! undefined max requests allowed

Further details:

  • discord.js version: 11.4.2
  • Node.js version: 11.10.0
  • Operating system: Ubuntu 18.10
  • Priority this issue should have – please be realistic and elaborate if possible: low

Not sure how I should test rate limit locally, happy to do so if someone can tell me the best method

  • I have also tested the issue on latest master, commit hash:
@almostSouji
Copy link
Member

The data is emitted as data.limit:

this.client.emit(RATE_LIMIT, {
limit: this.requestLimit,
timeDifference: this.timeDifference,
path: item.request.path,
method: item.request.method,
});

But documented as data.requestLimit, probably mixed up the naming from the this context:
/**
* Emitted when the client hits a rate limit while making a request
* @event Client#rateLimit
* @param {Object} rateLimitInfo Object containing the rate limit info
* @param {number} rateLimitInfo.requestLimit Number of requests that can be made to this endpoint
* @param {number} rateLimitInfo.timeDifference Delta-T in ms between your system and Discord servers
* @param {string} rateLimitInfo.method HTTP method used for request that triggered this event
* @param {string} rateLimitInfo.path Path used for request that triggered this event
*/

This is correctly documented on the master docs, I will PR the doc fix for 11.4-dev shortly

@niekcandaele
Copy link
Author

Ahhh thank you very much! :)

almostSouji added a commit to almostSouji/discord.js that referenced this issue Mar 7, 2019
SpaceEEC pushed a commit that referenced this issue Mar 7, 2019
* fix doc for ratelimit data, fixes #3131

* adapt typings

* typings: unindent #region comments
@SpaceEEC
Copy link
Member

SpaceEEC commented Mar 7, 2019

Fixed with the referenced commit ^

@SpaceEEC SpaceEEC closed this as completed Mar 7, 2019
theLAZYmd added a commit to theLAZYmd/discord.js that referenced this issue Aug 14, 2019
* Docs: document ChannelData.parent and .permissionOverwrites, fix typedefs to not include Collection of ChannelCreationOverwrite  (discordjs#2734)

* document ChannelData.parent

* document ChannelData.permissionOverwrites

* Overwrites also take other things, account for it

* note to self: stop copy-pasting

* remove eslint madness, fix param defs

* fix property slip

* Bump to 11.4.2

* refactor: Merge typings into 11.4-dev branch

* fix(Message): properly check for an edited_timestamp in patch

Fixes discordjs#2750

* fix(Permissions): Permissions itself is a valid PermissionResolvable

fixes discordjs#2753

* typings: make PermissionResolvable recursive

* backport: handle async stacktraces correctly (discordjs#2768)

* fix: WebhookClient should handle ratelimits properly

* fix: pin & update deps

* fix: disable getter-return

* fix(webpack): properly emitting process deprecation warnings

* backport: User#dmChannel perf enhancement (discordjs#2780)

* docs(Emoji): fix typo of the word "emoji" (discordjs#2791)

* fix: Guild#addMember incorrectly resolving userID

* backport: WEBHOOKS_UPDATE event (discordjs#2779)

* typings: add WEBHOOKS_UPDATE

* typings: clean up permissionResolvable

* backport: Deprecate allowed/denied as discordjs#2765 (discordjs#2792)

* fix(GuildChannel#lockPermissions): Properties allow and deny always returning undefined (discordjs#2800)

* fix undefined properties

* requested changes

* backport: `GUILD_INTEGRATIONS_UPDATE` event (discordjs#2794)

* backport: Client#on{guildIntegrationsUpdate,webhookUpdate}

misc: Update Constants.WSEvents and WSEventType

backport: Add guildIntegrationsUpdate event handler

* docs: Updated typings

* backport: Guild#{fetchEmbed,setEmbed} (discordjs#2778)

*  backport: Guild Embeds

* fix: Added missing return

* docs: Updated typings

* backport: UNKNOWN_WEBHOOK (discordjs#2777)

* docs: Added `url` to Invite's warning comment (discordjs#2804)

And added the [serial comma](https://en.wikipedia.org/wiki/Serial_comma)

* fix(Guild#deleteEmoji): reject non emojis / emoji IDs (discordjs#2793)

* fix(Guild#deleteEmoji): Performing wrong checks

* fix: requested changes

`a string` -> `an id`

* fix: requested changes

`id` -> `ID`

* docs: correct Guild#memberCount (discordjs#2812)

* build(peer-deps): use uws fork backport (discordjs#2782)

* build(peer-deps): uws backport

* chore: update to 149 for uws

* docs(User): clarify what User#tag represents

Closes discordjs#2828

* backport(ClientOptions): add retryLimit (discordjs#2869)

* backport: rateLimitPerUser (discordjs#2874)

* backport(Guild): add fetchVanityCode (discordjs#2871)

* docs(Game): document possible values for type property

See discordjs#2865

* typings: fix lint script and linter errors

* backport(TextBasedChannel): add lastPinTimestamp and lastPinAt (discordjs#2870)

And clarify Client#channelPinsUpdate's 'time' parameter.

* backport(Guild): support for createChannel with options object (discordjs#2888)

* fix: revert discordjs#2768 (discordjs#2848)

* fix: revert discordjs#2768

* fix merge

* Fix discordjs#2928 (member not being removed from voice channel after leaving guild)

* fix:(GuilChannel): clone method not taking overwrites into account (discordjs#2932)

* docs(GuildChannel): add rateLimitPerUser to ChannelData typdef

* backport(Guild): support for rateLimitPerUser when creating a channel

PR: discordjs#2878
Commit: 8ec3b51

* typings(RichEmbed): add MessageEmbed as valid data in constructor

See discordjs#2970

* docs:(TextChannel): add documentation for messages and lastMessage (discordjs#2986)

* [docs] add missing docs for <TextChannel>.messages

* add missing doc for <TextChannel>.lastMessage

* fix(TextBasedChannel): added missing lastMessage functionality in textchannels (discordjs#2999)

* docs(Webhook): add mising '@name' to Webhook#token's docstring

* typings(Guild): fix typos in method names

Fixes discordjs#3009

* typings(TextBasedChannel): fix create(Message)Collector's options type

* docs(Guild): use AuditLogAction for fetchAuditLogs' type option

* docs(Client): add missing parenthesis in fetchInvite example (discordjs#3023)

This is already fixed in master, resolves discordjs#3022

* docs(Client): add missing example tag and closing parenthesis (discordjs#3024)

* fix(Guild): ignore voice states referencing an invalid channel

This was causing an uncaught exception on startup (or whenever receiving such a payload) which is crashing the process.

* typings(SnowflakeUtil): add optional "timestamp" parameter to generate (discordjs#2998)

* feat(Constants): add error code 50020 (discordjs#2953)

* feat(Constants): Add error code 50020

Which is throw when using the vanity-url endpoint: discord/discord-api-docs#748

* docs: Document the new code

* feat(Util): add WHITE as color resolvable (discordjs#3062)

* feat(Presence): add clientStatus (discordjs#3056)

* feat(RichEmbed): add length getter (discordjs#3057)

* feat(Guild): add position to createChannel's implementation (discordjs#3058)

* fix(GuildMember): add explicit channel resolve error to member edit (discordjs#3059)

* fix(Util): splitMessage throws an error if a chunk is too large (discordjs#3060)

* feat(RichEmbed): add timestamp support for setTimestamp (discordjs#3061)

* fix(Emoji): reject explicit error when MANAGE_EMOJI permissions are missing (discordjs#3063)

* Mark peer dependencies as optional (discordjs#3066)

* docs(Guild): update createChannel examples to not use deprecated overload

* fix typo

* docs/typings: RateLimitInfo#limit instead of requestLimit (discordjs#3132)

* fix doc for ratelimit data, fixes discordjs#3131

* adapt typings

* typings: unindent #region comments

* fix discordjs#3150: can now create dispatcher with 0 volume

* feat(Guild): add fetchBan and withReasons to fetchBans (discordjs#3170)

* add Guild#fetchBan() & backport BanInfo

* and the typings

* requested changes

* typings overloads

Co-Authored-By: izexi <43889168+izexi@users.noreply.github.com>

* nullable reason typings

Co-Authored-By: izexi <43889168+izexi@users.noreply.github.com>

* typings(Collection): add typings for partition (discordjs#3166)

* fix(Guild): sort roles with the same position in the correct order (discordjs#3184)

* docs(Collection): fix findKey jsdoc (discordjs#3204)

* typings(GuildChannel): add manageable getter

* fix(WebSocketConnection): stringify data when no websocket is available

[object Object] is not really descriptive

* fix/docs(Client): type status and do not throw an error if accessed before login

* feat(GuildMember): add support for voice kicking (discordjs#3246)

This backports e64773e (discordjs#3242)

* Backport news/store channels

* Remove unnecessary import

* Add news/store channel support to CHANNEL_CREATE

* Document news/store channel types on Guild#createChannel

* Update typings for news/store channels

* Add testing for Node.js 8-12

* Bump version to 11.5.0

* docs(Guild): fix typo in example of createChannel

* docs(TextChanne): specify unit of rateLimitPerUser (discordjs#3272)

* Update TextChannel.js

Update `setRateLimitPerUser` description to specify the `number` is in seconds, per the Discord docs

* Update TextChannel.js

Add unit to the rateLimitPerUser property

* Update GuildChannel.js

* docs(ChannelCreationOverwrites): revert incorrect rename of "id" property (discordjs#3273)

Reverts one incorrect change made in discordjs#2734 (discordjs@3021e5c#diff-e5c54069adfa0d32480eb3cc9faeee20L979)

* Fix incorrect docs in Guild.js

* Update src/structures/Guild.js

Co-Authored-By: SpaceEEC <spaceeec@yahoo.com>

* Update Guild.js

* fix(GuildMember): do not create a channel key when editing

This is to not break GuildMember#setNickname for the current user

* fix(Message#pinnable): you can't pin system messages (discordjs#3279)

* chore: explicitly mark everything deprecated as `@ deprecated` (discordjs#3307)

* v11.5.1
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants