Datastore cleanup (#1892)

* Start Store cleanup

* wip store cleanup

* fix iterables initiating datastores

* handle the possibility of a datastore with no holds and no its own 'create' method

* more cleanup (instances that need more than just client/data)

* missed RoleStore extras

* not sure how eslint didn't catch that tab...

* avoid re-getting the channel we already have...

* cleanup resolvers and refactor them into DataStores

* ^

* and remove

* fix some bugs

* fix lint

* fix documentation maybe?

* formatting

* fix presences

* really fix presences this time

* bad fix was bad... let;s see how bad this one is..

* forgot to save a file

* make presence resolving take userresolveables too

* fix tabs in jsdocs

* fix bad fix from last night that caused issues, with better fix...

* oops
This commit is contained in:
bdistin
2017-09-08 16:06:10 -05:00
committed by Crawl
parent 0607720ec8
commit dd085ceaee
34 changed files with 560 additions and 435 deletions

View File

@@ -1,5 +1,6 @@
const DataStore = require('./DataStore');
const Channel = require('../structures/Channel');
const GuildChannel = require('../structures/GuildChannel');
/**
* Stores guild channels.
@@ -8,7 +9,7 @@ const Channel = require('../structures/Channel');
*/
class GuildChannelStore extends DataStore {
constructor(guild, iterable) {
super(guild.client, iterable);
super(guild.client, iterable, GuildChannel);
this.guild = guild;
}
@@ -18,6 +19,29 @@ class GuildChannelStore extends DataStore {
return Channel.create(this.client, data, this.guild);
}
/**
* Data that can be resolved to give a Channel object. This can be:
* * A GuildChannel object
* * A Snowflake
* @typedef {Channel|Snowflake} GuildChannelResolvable
*/
/**
* Resolves a GuildChannelResolvable to a Channel object.
* @method resolve
* @memberof GuildChannelStore
* @param {GuildChannelResolvable} channel The GuildChannel resolvable to resolve
* @returns {?Channel}
*/
/**
* Resolves a GuildChannelResolvable to a channel ID string.
* @method resolveID
* @memberof GuildChannelStore
* @param {GuildChannelResolvable} channel The GuildChannel resolvable to resolve
* @returns {?string}
*/
}
module.exports = GuildChannelStore;