docs(*Resolvable): make them appear on the docs

I don't know what part of the docgen is not working properly, but this seems to fix those typedef
to not appear on the documentation
This commit is contained in:
SpaceEEC
2019-06-05 22:18:06 +02:00
parent 8e1857286d
commit 4a2335c69c
3 changed files with 68 additions and 69 deletions

View File

@@ -78,25 +78,6 @@ class ChannelStore extends DataStore {
super.remove(id);
}
/**
* Obtains a channel from Discord, or the channel cache if it's already available.
* @param {Snowflake} id ID of the channel
* @param {boolean} [cache=true] Whether to cache the new channel object if it isn't already
* @returns {Promise<Channel>}
* @example
* // Fetch a channel by its id
* client.channels.fetch('222109930545610754')
* .then(channel => console.log(channel.name))
* .catch(console.error);
*/
async fetch(id, cache = true) {
const existing = this.get(id);
if (existing && !existing.partial) return existing;
const data = await this.client.api.channels(id).get();
return this.add(data, null, cache);
}
/**
* Data that can be resolved to give a Channel object. This can be:
* * A Channel object
@@ -121,6 +102,25 @@ class ChannelStore extends DataStore {
* @param {ChannelResolvable} channel The channel resolvable to resolve
* @returns {?Snowflake}
*/
/**
* Obtains a channel from Discord, or the channel cache if it's already available.
* @param {Snowflake} id ID of the channel
* @param {boolean} [cache=true] Whether to cache the new channel object if it isn't already
* @returns {Promise<Channel>}
* @example
* // Fetch a channel by its id
* client.channels.fetch('222109930545610754')
* .then(channel => console.log(channel.name))
* .catch(console.error);
*/
async fetch(id, cache = true) {
const existing = this.get(id);
if (existing && !existing.partial) return existing;
const data = await this.client.api.channels(id).get();
return this.add(data, null, cache);
}
}
module.exports = ChannelStore;

View File

@@ -22,6 +22,31 @@ class GuildChannelStore extends DataStore {
return channel;
}
/**
* Data that can be resolved to give a Guild Channel object. This can be:
* * A GuildChannel object
* * A Snowflake
* @typedef {GuildChannel|Snowflake} GuildChannelResolvable
*/
/**
* Resolves a GuildChannelResolvable to a Channel object.
* @method resolve
* @memberof GuildChannelStore
* @instance
* @param {GuildChannelResolvable} channel The GuildChannel resolvable to resolve
* @returns {?Channel}
*/
/**
* Resolves a GuildChannelResolvable to a channel ID string.
* @method resolveID
* @memberof GuildChannelStore
* @instance
* @param {GuildChannelResolvable} channel The GuildChannel resolvable to resolve
* @returns {?Snowflake}
*/
/**
* Creates a new channel in the guild.
* @param {string} name The name of the new channel
@@ -90,31 +115,6 @@ class GuildChannelStore extends DataStore {
});
return this.client.actions.ChannelCreate.handle(data).channel;
}
/**
* Data that can be resolved to give a Guild Channel object. This can be:
* * A GuildChannel object
* * A Snowflake
* @typedef {GuildChannel|Snowflake} GuildChannelResolvable
*/
/**
* Resolves a GuildChannelResolvable to a Channel object.
* @method resolve
* @memberof GuildChannelStore
* @instance
* @param {GuildChannelResolvable} channel The GuildChannel resolvable to resolve
* @returns {?Channel}
*/
/**
* Resolves a GuildChannelResolvable to a channel ID string.
* @method resolveID
* @memberof GuildChannelStore
* @instance
* @param {GuildChannelResolvable} channel The GuildChannel resolvable to resolve
* @returns {?Snowflake}
*/
}
module.exports = GuildChannelStore;

View File

@@ -82,31 +82,6 @@ class MessageStore extends DataStore {
});
}
/**
* Deletes a message, even if it's not cached.
* @param {MessageResolvable} message The message to delete
* @param {string} [reason] Reason for deleting this message, if it does not belong to the client user
*/
async remove(message, reason) {
message = this.resolveID(message);
if (message) await this.client.api.channels(this.channel.id).messages(message).delete({ reason });
}
async _fetchId(messageID, cache) {
const existing = this.get(messageID);
if (existing && !existing.partial) return existing;
const data = await this.client.api.channels[this.channel.id].messages[messageID].get();
return this.add(data, cache);
}
async _fetchMany(options = {}, cache) {
const data = await this.client.api.channels[this.channel.id].messages.get({ query: options });
const messages = new Collection();
for (const message of data) messages.set(message.id, this.add(message, cache));
return messages;
}
/**
* Data that can be resolved to a Message object. This can be:
* * A Message
@@ -131,6 +106,30 @@ class MessageStore extends DataStore {
* @param {MessageResolvable} message The message resolvable to resolve
* @returns {?Snowflake}
*/
/**
* Deletes a message, even if it's not cached.
* @param {MessageResolvable} message The message to delete
* @param {string} [reason] Reason for deleting this message, if it does not belong to the client user
*/
async remove(message, reason) {
message = this.resolveID(message);
if (message) await this.client.api.channels(this.channel.id).messages(message).delete({ reason });
}
async _fetchId(messageID, cache) {
const existing = this.get(messageID);
if (existing && !existing.partial) return existing;
const data = await this.client.api.channels[this.channel.id].messages[messageID].get();
return this.add(data, cache);
}
async _fetchMany(options = {}, cache) {
const data = await this.client.api.channels[this.channel.id].messages.get({ query: options });
const messages = new Collection();
for (const message of data) messages.set(message.id, this.add(message, cache));
return messages;
}
}
module.exports = MessageStore;