mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user