-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
refactor/fix(DataStores): move instantiating of store related classes into their date stores #1869
Conversation
… into the relevant create methods and fixed FetchMemberOptions
…avoid the client property being undefined
src/stores/ChannelStore.js
Outdated
constructor(iterable, options = {}) { | ||
super(iterable); | ||
constructor(client, options = {}) { | ||
super(client); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this remove the option of passing in an iterable? Not that I know a use case specifically where it would be needed, but all other stores can handle iterables being passed in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't possible previously, I just renamed the variable.
I'll add this either way, since all other stores are offering it.
* such presence many good * Update PresenceStore.js * Update index.js * Update ClientPresenceStore.js * Update Presence.js * Update ClientPresenceStore.js * Update ClientUser.js * Update Presence.js * add timestamps and party * Update Presence.js * Update PresenceStore.js * Update ClientPresenceStore.js * Update ClientPresenceStore.js
…1875) * fix: made options.type optional in ClientUser#setActivity * some changes, smol fix due to too many types being possible, it should just be defaulted to 0. this means streamers will have to set the type manually, though. also mistake with activity.name check
Since the return value of Collection#exists is basically just a boolean of Collection#find's result, the same documentation and arguments can and should be applied.
… into the relevant create methods and fixed FetchMemberOptions
…avoid the client property being undefined
Please describe the changes this PR makes and why it should be merged:
Data Store:
client
property in theDataStore
's constructor before iterating the eventual passed iterable to avoid the client property being undefined when executingcreate
.(Guild)Channel Store:
Channel#create
over instantiating in Channel Stores / any other files.ChannelStore
's iterable parameter in the constructor is actually aClient
, renamed for clarity.iterable
parameter.GuildMember Store:
FetchMemberOptions#user
)GuildMemberStore
as public class soGuildMemberStore#fetch
can be found in the docs.GuildMemberStore#_fetchMany
now rejects with the intended error message, rather then its key.GuildMemberStore#_fetchMany
now resolves when the limit of fetched members is reached or the full member count has been reached.RegardingGuildMemberStore#_fetchMany
:How is fetching with a limit / query expected to work?
Fetching with a limit of 1000 fetches those 1000 but doesn't resolve the promies, which will time out and reject then.
The condition seems off here sincemembers.size
will (or should) never be< 1000
.See DiscordAPI docs:
up to 1000 members per chunk
(My bad, > and < are hard to read :^))I am not sure how to fix this.Semantic versioning classification: