fix types for snowflakes (#1156)

* fix types for snowflakes

* Update TextBasedChannel.js
This commit is contained in:
Gus Caplan
2017-02-03 20:37:58 -06:00
committed by Schuyler Cebulskie
parent 0b5eeb08f3
commit 59ff1d99ba
9 changed files with 23 additions and 23 deletions

View File

@@ -92,26 +92,26 @@ class Client extends EventEmitter {
/** /**
* A collection of the Client's stored users * A collection of the Client's stored users
* @type {Collection<string, User>} * @type {Collection<Snowflake, User>}
*/ */
this.users = new Collection(); this.users = new Collection();
/** /**
* A collection of the Client's stored guilds * A collection of the Client's stored guilds
* @type {Collection<string, Guild>} * @type {Collection<Snowflake, Guild>}
*/ */
this.guilds = new Collection(); this.guilds = new Collection();
/** /**
* A collection of the Client's stored channels * A collection of the Client's stored channels
* @type {Collection<string, Channel>} * @type {Collection<Snowflake, Channel>}
*/ */
this.channels = new Collection(); this.channels = new Collection();
/** /**
* A collection of presences for friends of the logged in user. * A collection of presences for friends of the logged in user.
* <warn>This is only filled when using a user account.</warn> * <warn>This is only filled when using a user account.</warn>
* @type {Collection<string, Presence>} * @type {Collection<Snowflake, Presence>}
*/ */
this.presences = new Collection(); this.presences = new Collection();
@@ -191,7 +191,7 @@ class Client extends EventEmitter {
/** /**
* The emojis that the client can use. Mapped by emoji ID. * The emojis that the client can use. Mapped by emoji ID.
* @type {Collection<string, Emoji>} * @type {Collection<Snowflake, Emoji>}
* @readonly * @readonly
*/ */
get emojis() { get emojis() {
@@ -257,7 +257,7 @@ class Client extends EventEmitter {
* This shouldn't really be necessary to most developers as it is automatically invoked every 30 seconds, however * This shouldn't really be necessary to most developers as it is automatically invoked every 30 seconds, however
* if you wish to force a sync of guild data, you can use this. * if you wish to force a sync of guild data, you can use this.
* <warn>This is only available when using a user account.</warn> * <warn>This is only available when using a user account.</warn>
* @param {Guild[]|Collection<string, Guild>} [guilds=this.guilds] An array or collection of guilds to sync * @param {Guild[]|Collection<Snowflake, Guild>} [guilds=this.guilds] An array or collection of guilds to sync
*/ */
syncGuilds(guilds = this.guilds) { syncGuilds(guilds = this.guilds) {
if (this.user.bot) return; if (this.user.bot) return;

View File

@@ -18,13 +18,13 @@ class ClientVoiceManager {
/** /**
* A collection mapping connection IDs to the Connection objects * A collection mapping connection IDs to the Connection objects
* @type {Collection<string, VoiceConnection>} * @type {Collection<Snowflake, VoiceConnection>}
*/ */
this.connections = new Collection(); this.connections = new Collection();
/** /**
* Pending connection attempts, maps guild ID to VoiceChannel * Pending connection attempts, maps guild ID to VoiceChannel
* @type {Collection<string, VoiceChannel>} * @type {Collection<Snowflake, VoiceChannel>}
*/ */
this.pending = new Collection(); this.pending = new Collection();

View File

@@ -26,7 +26,7 @@ class GuildMembersChunkHandler extends AbstractHandler {
/** /**
* Emitted whenever a chunk of guild members is received (all members come from the same guild) * Emitted whenever a chunk of guild members is received (all members come from the same guild)
* @event Client#guildMembersChunk * @event Client#guildMembersChunk
* @param {Collection<GuildMember>} members The members in the chunk * @param {Collection<Snowflake, GuildMember>} members The members in the chunk
* @param {Guild} guild The guild related to the member chunk * @param {Guild} guild The guild related to the member chunk
*/ */

View File

@@ -11,7 +11,7 @@ class MessageDeleteBulkHandler extends AbstractHandler {
/** /**
* Emitted whenever messages are deleted in bulk * Emitted whenever messages are deleted in bulk
* @event Client#messageDeleteBulk * @event Client#messageDeleteBulk
* @param {Collection<string, Message>} messages The deleted messages, mapped by their ID * @param {Collection<Snowflake, Message>} messages The deleted messages, mapped by their ID
*/ */
module.exports = MessageDeleteBulkHandler; module.exports = MessageDeleteBulkHandler;

View File

@@ -301,7 +301,7 @@ class Guild {
/** /**
* Fetch a collection of banned users in this guild. * Fetch a collection of banned users in this guild.
* @returns {Promise<Collection<string, User>>} * @returns {Promise<Collection<Snowflake, User>>}
*/ */
fetchBans() { fetchBans() {
return this.client.rest.methods.getGuildBans(this); return this.client.rest.methods.getGuildBans(this);
@@ -317,7 +317,7 @@ class Guild {
/** /**
* Fetch all webhooks for the guild. * Fetch all webhooks for the guild.
* @returns {Collection<Webhook>} * @returns {Collection<Snowflake, Webhook>}
*/ */
fetchWebhooks() { fetchWebhooks() {
return this.client.rest.methods.getGuildWebhooks(this); return this.client.rest.methods.getGuildWebhooks(this);

View File

@@ -322,7 +322,7 @@ class GuildMember {
/** /**
* Sets the roles applied to the member. * Sets the roles applied to the member.
* @param {Collection<string, Role>|Role[]|string[]} roles The roles or role IDs to apply * @param {Collection<Snowflake, Role>|Role[]|string[]} roles The roles or role IDs to apply
* @returns {Promise<GuildMember>} * @returns {Promise<GuildMember>}
*/ */
setRoles(roles) { setRoles(roles) {
@@ -341,7 +341,7 @@ class GuildMember {
/** /**
* Adds multiple roles to the member. * Adds multiple roles to the member.
* @param {Collection<string, Role>|Role[]|string[]} roles The roles or role IDs to add * @param {Collection<Snowflake, Role>|Role[]|string[]} roles The roles or role IDs to add
* @returns {Promise<GuildMember>} * @returns {Promise<GuildMember>}
*/ */
addRoles(roles) { addRoles(roles) {
@@ -367,7 +367,7 @@ class GuildMember {
/** /**
* Removes multiple roles from the member. * Removes multiple roles from the member.
* @param {Collection<string, Role>|Role[]|string[]} roles The roles or role IDs to remove * @param {Collection<Snowflake, Role>|Role[]|string[]} roles The roles or role IDs to remove
* @returns {Promise<GuildMember>} * @returns {Promise<GuildMember>}
*/ */
removeRoles(roles) { removeRoles(roles) {

View File

@@ -137,7 +137,7 @@ class MessageCollector extends EventEmitter {
this.channel.client.removeListener('message', this.listener); this.channel.client.removeListener('message', this.listener);
/** /**
* Emitted when the Collector stops collecting. * Emitted when the Collector stops collecting.
* @param {Collection<string, Message>} collection A collection of messages collected * @param {Collection<Snowflake, Message>} collection A collection of messages collected
* during the lifetime of the collector, mapped by the ID of the messages. * during the lifetime of the collector, mapped by the ID of the messages.
* @param {string} reason The reason for the end of the collector. If it ended because it reached the specified time * @param {string} reason The reason for the end of the collector. If it ended because it reached the specified time
* limit, this would be `time`. If you invoke `.stop()` without specifying a reason, this would be `user`. If it * limit, this would be `time`. If you invoke `.stop()` without specifying a reason, this would be `user`. If it

View File

@@ -22,13 +22,13 @@ class UserProfile {
/** /**
* Guilds that the client user and the user share * Guilds that the client user and the user share
* @type {Collection<Guild>} * @type {Collection<Snowflake, Guild>}
*/ */
this.mutualGuilds = new Collection(); this.mutualGuilds = new Collection();
/** /**
* The user's connections * The user's connections
* @type {Collection<UserConnection>} * @type {Collection<String, UserConnection>}
*/ */
this.connections = new Collection(); this.connections = new Collection();

View File

@@ -188,7 +188,7 @@ class TextBasedChannel {
/** /**
* Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects. * Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects.
* @param {ChannelLogsQueryOptions} [options={}] Query parameters to pass in * @param {ChannelLogsQueryOptions} [options={}] Query parameters to pass in
* @returns {Promise<Collection<string, Message>>} * @returns {Promise<Collection<Snowflake, Message>>}
* @example * @example
* // get messages * // get messages
* channel.fetchMessages({limit: 10}) * channel.fetchMessages({limit: 10})
@@ -209,7 +209,7 @@ class TextBasedChannel {
/** /**
* Fetches the pinned messages of this channel and returns a collection of them. * Fetches the pinned messages of this channel and returns a collection of them.
* @returns {Promise<Collection<string, Message>>} * @returns {Promise<Collection<Snowflake, Message>>}
*/ */
fetchPinnedMessages() { fetchPinnedMessages() {
return this.client.rest.methods.getChannelPinnedMessages(this).then(data => { return this.client.rest.methods.getChannelPinnedMessages(this).then(data => {
@@ -336,7 +336,7 @@ class TextBasedChannel {
* filter. * filter.
* @param {CollectorFilterFunction} filter The filter function to use * @param {CollectorFilterFunction} filter The filter function to use
* @param {AwaitMessagesOptions} [options={}] Optional options to pass to the internal collector * @param {AwaitMessagesOptions} [options={}] Optional options to pass to the internal collector
* @returns {Promise<Collection<string, Message>>} * @returns {Promise<Collection<Snowflake, Message>>}
* @example * @example
* // await !vote messages * // await !vote messages
* const filter = m => m.content.startsWith('!vote'); * const filter = m => m.content.startsWith('!vote');
@@ -361,9 +361,9 @@ class TextBasedChannel {
/** /**
* Bulk delete given messages that are newer than two weeks * Bulk delete given messages that are newer than two weeks
* <warn>This is only available when using a bot account.</warn> * <warn>This is only available when using a bot account.</warn>
* @param {Collection<string, Message>|Message[]|number} messages Messages to delete, or number of messages to delete * @param {Collection<Snowflake, Message>|Message[]|number} messages Messages or number of messages to delete
* @param {boolean} [filterOld=false] Filter messages to remove those which are older than two weeks automatically * @param {boolean} [filterOld=false] Filter messages to remove those which are older than two weeks automatically
* @returns {Promise<Collection<string, Message>>} Deleted messages * @returns {Promise<Collection<Snowflake, Message>>} Deleted messages
*/ */
bulkDelete(messages, filterOld = false) { bulkDelete(messages, filterOld = false) {
if (!isNaN(messages)) return this.fetchMessages({ limit: messages }).then(msgs => this.bulkDelete(msgs)); if (!isNaN(messages)) return this.fetchMessages({ limit: messages }).then(msgs => this.bulkDelete(msgs));