Skip to content

Commit

Permalink
Lint, cleanup docs
Browse files Browse the repository at this point in the history
  • Loading branch information
abalabahaha committed Apr 25, 2021
1 parent fba1f7c commit e06f38a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 55 deletions.
6 changes: 4 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1938,9 +1938,10 @@ declare namespace Eris {
editRole(roleID: string, options: RoleOptions): Promise<Role>;
editTemplate(code: string, options: GuildTemplateOptions): Promise<GuildTemplate>;
editVanity(code: string): Promise<GuildVanity>;
editVoiceState(options: VoiceStateOptions, userID?: string): Promise<void>;
editWelcomeScreen(options: WelcomeScreenOptions): Promise<WelcomeScreen>;
editWidget(options: Widget): Promise<Widget>;
editVoiceState(options: VoiceStateOptions, userID?: string): Promise<void>;

fetchAllMembers(timeout?: number): Promise<number>;
fetchMembers(options?: FetchMembersOptions): Promise<Member[]>;
getAuditLogs(limit?: number, before?: string, actionType?: number, userID?: string): Promise<GuildAuditLog>;
Expand Down Expand Up @@ -2160,6 +2161,7 @@ declare namespace Eris {
flags: number;
guildID: T extends GuildTextable ? string : undefined;
id: string;
interaction: MessageInteraction | null;
jumpLink: string;
member: T extends GuildTextable ? Member : null;
mentionEveryone: boolean;
Expand All @@ -2171,7 +2173,7 @@ declare namespace Eris {
referencedMessage?: Message | null;
roleMentions: string[];
stickers?: Sticker[];
interaction: MessageInteraction | null;

timestamp: number;
tts: boolean;
type: number;
Expand Down
64 changes: 33 additions & 31 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ class Client extends EventEmitter {

/**
* Add a guild discovery subcategory
* @param {String} guildID The ID of the guild
* @param {String} categoryID The ID of the discovery category
* @param {String} [reason] The reason to be displayed in audit logs
* @arg {String} guildID The ID of the guild
* @arg {String} categoryID The ID of the discovery category
* @arg {String} [reason] The reason to be displayed in audit logs
* @returns {Promise<Object>}
*/
addGuildDiscoverySubcategory(guildID, categoryID, reason) {
Expand Down Expand Up @@ -685,9 +685,9 @@ class Client extends EventEmitter {

/**
* Delete a guild discovery subcategory
* @param {String} guildID The ID of the guild
* @param {String} categoryID The ID of the discovery category
* @param {String} [reason] The reason to be displayed in audit logs
* @arg {String} guildID The ID of the guild
* @arg {String} categoryID The ID of the discovery category
* @arg {String} [reason] The reason to be displayed in audit logs
* @returns {Promise}
*/
deleteGuildDiscoverySubcategory(guildID, categoryID, reason) {
Expand Down Expand Up @@ -1034,12 +1034,12 @@ class Client extends EventEmitter {

/**
* Edit a guild's discovery data
* @param {String} guildID The ID of the guild
* @param {Object} [options] The guild discovery data
* @param {String} [options.primaryCategoryID] The primary discovery category ID
* @param {Array<String>} [options.keywords] The discovery keywords (max 10)
* @param {Boolean} [options.emojiDiscoverabilityEnabled] Whether guild info should be shown when emoji info is loaded
* @param {String} [options.reason] The reason to be displayed in audit logs
* @arg {String} guildID The ID of the guild
* @arg {Object} [options] The guild discovery data
* @arg {String} [options.primaryCategoryID] The primary discovery category ID
* @arg {Array<String>} [options.keywords] The discovery keywords (max 10)
* @arg {Boolean} [options.emojiDiscoverabilityEnabled] Whether guild info should be shown when emoji info is loaded
* @arg {String} [options.reason] The reason to be displayed in audit logs
* @returns {Promise<Object>} The updated guild's discovery object
*/
editGuildDiscovery(guildID, options = {}) {
Expand Down Expand Up @@ -1121,6 +1121,17 @@ class Client extends EventEmitter {
return this.requestHandler.request("PATCH", Endpoints.GUILD_TEMPLATE_GUILD(guildID, code), true, options).then((template) => new GuildTemplate(template, this));
}

/**
* Modify a guild's vanity code
* @arg {String} guildID The ID of the guild
* @arg {String} code The new vanity code
* @returns {Promise<Object>}
*/
editGuildVanity(guildID, code) {
return this.requestHandler.request("PATCH", Endpoints.GUILD_VANITY_URL(guildID), true, {
code
});
}
/**
* Update a user's voice state - See [caveats](https://discord.com/developers/docs/resources/guild#update-others-voice-state-caveats)
* @param {String} guildID The ID of the guild
Expand Down Expand Up @@ -1399,17 +1410,8 @@ class Client extends EventEmitter {
});
}

/**
* Modify a guild's vanity code
* @arg {String} guildID The ID of the guild
* @arg {String} code The new vanity code
* @returns {Promise<Object>}
*/
editGuildVanity(guildID, code) {
return this.requestHandler.request("PATCH", Endpoints.GUILD_VANITY_URL(guildID), true, {
code
});
}



/**
* Edit a webhook
Expand Down Expand Up @@ -1608,7 +1610,7 @@ class Client extends EventEmitter {

/**
* Get a guild from the guild's emoji ID
* @param {String} emojiID The ID of the emoji
* @arg {String} emojiID The ID of the emoji
* @returns {Promise<Guild>}
*/
getEmojiGuild(emojiID) {
Expand Down Expand Up @@ -1678,7 +1680,7 @@ class Client extends EventEmitter {

/**
* Get a guild's discovery object
* @param {String} guildID The ID of the guild
* @arg {String} guildID The ID of the guild
* @returns {Promise<Object>}
*/
getGuildDiscovery(guildID) {
Expand Down Expand Up @@ -1728,7 +1730,7 @@ class Client extends EventEmitter {

/**
* Get a guild template
* @param {String} code The template code
* @arg {String} code The template code
* @returns {Promise<GuildTemplate>}
*/
getGuildTemplate(code) {
Expand All @@ -1737,7 +1739,7 @@ class Client extends EventEmitter {

/**
* Get a guild's templates
* @param {String} guildID The ID of the guild
* @arg {String} guildID The ID of the guild
* @returns {Promise<Array<GuildTemplate>>}
*/
getGuildTemplates(guildID) {
Expand Down Expand Up @@ -1934,7 +1936,7 @@ class Client extends EventEmitter {
/**
* Get a guild's channels via the REST API. REST mode is required to use this endpoint.
* @arg {String} guildID The ID of the guild
* @returns {Promise<(CategoryChannel[] | TextChannel[] | VoiceChannel[] | NewsChannel[])>}
* @returns {Promise<CategoryChannel[] | TextChannel[] | VoiceChannel[] | NewsChannel[]>}
*/
getRESTGuildChannels(guildID) {
if(!this.options.restMode) {
Expand Down Expand Up @@ -2511,8 +2513,8 @@ class Client extends EventEmitter {

/**
* Force a guild template to sync
* @param {String} guildID The ID of the guild
* @param {String} code The template code
* @arg {String} guildID The ID of the guild
* @arg {String} code The template code
* @returns {Promise<GuildTemplate>}
*/
syncGuildTemplate(guildID, code) {
Expand Down Expand Up @@ -2544,7 +2546,7 @@ class Client extends EventEmitter {

/**
* Validate discovery search term
* @param {String} term The search term to check
* @arg {String} term The search term to check
* @returns {Promise<Object>} An object with a `valid` field which is `true` when valid and `false` when invalid
*/
validateDiscoverySearchTerm(term) {
Expand Down
11 changes: 1 addition & 10 deletions lib/gateway/Shard.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ class Shard extends EventEmitter {
/**
* Fired when a guild member leaves a voice channel. This event is not fired when a member switches voice channels, see `voiceChannelSwitch`
* @event Client#voiceChannelLeave
* @prop {?Member} member The member
* @prop {Member?} member The member
* @prop {VoiceChannel | StageChannel} oldChannel The voice channel
*/
this.emit("voiceChannelLeave", member, oldChannel);
Expand Down Expand Up @@ -1109,15 +1109,6 @@ class Shard extends EventEmitter {
}
if(!user || oldUser) {
user = this.client.users.update(packet.d.user, this.client);
/**
* Fired when a user's username, avatar, or discriminator changes
* @event Client#userUpdate
* @prop {User} user The updated user
* @prop {Object?} oldUser The old user data
* @prop {String} oldUser.username The username of the user
* @prop {String} oldUser.discriminator The discriminator of the user
* @prop {String?} oldUser.avatar The hash of the user's avatar, or null if no avatar
*/
this.emit("userUpdate", user, oldUser);
}
}
Expand Down
22 changes: 11 additions & 11 deletions lib/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ class Guild extends Base {

/**
* Add a discovery subcategory
* @param {String} categoryID The ID of the discovery category
* @param {String} [reason] The reason to be displayed in audit logs
* @arg {String} categoryID The ID of the discovery category
* @arg {String} [reason] The reason to be displayed in audit logs
* @returns {Promise<Object>}
*/
addDiscoverySubcategory(categoryID, reason) {
Expand Down Expand Up @@ -402,8 +402,8 @@ class Guild extends Base {

/**
* Delete a discovery subcategory
* @param {String} categoryID The ID of the discovery category
* @param {String} [reason] The reason to be displayed in audit logs
* @arg {String} categoryID The ID of the discovery category
* @arg {String} [reason] The reason to be displayed in audit logs
* @returns {Promise}
*/
deleteDiscoverySubcategory(categoryID, reason) {
Expand Down Expand Up @@ -460,7 +460,7 @@ class Guild extends Base {
/**
* Get the guild's discovery splash with the given format and size
* @arg {String} [format] The filetype of the icon ("jpg", "jpeg", "png", "gif", or "webp")
* @param {Number} [size] The size of the icon (any power of two between 16 and 4096)
* @arg {Number} [size] The size of the icon (any power of two between 16 and 4096)
*/
dynamicDiscoverySplashURL(format, size) {
return this.discoverySplash ? this._client._formatImage(Endpoints.GUILD_DISCOVERY_SPLASH(this.id, this.discoverySplash), format, size) : null;
Expand Down Expand Up @@ -515,11 +515,11 @@ class Guild extends Base {

/**
* Edit the guild's discovery data
* @param {Object} [options] The guild discovery data
* @param {String} [options.primaryCategoryID] The primary discovery category ID
* @param {Array<String>} [options.keywords] The discovery keywords (max 10)
* @param {Boolean} [options.emojiDiscoverabilityEnabled] Whether guild info should be shown when emoji info is loaded
* @param {String} [options.reason] The reason to be displayed in audit logs
* @arg {Object} [options] The guild discovery data
* @arg {String} [options.primaryCategoryID] The primary discovery category ID
* @arg {Array<String>} [options.keywords] The discovery keywords (max 10)
* @arg {Boolean} [options.emojiDiscoverabilityEnabled] Whether guild info should be shown when emoji info is loaded
* @arg {String} [options.reason] The reason to be displayed in audit logs
* @returns {Promise<Object>} The updated discovery object
*/
editDiscovery(options) {
Expand Down Expand Up @@ -755,7 +755,7 @@ class Guild extends Base {

/**
* Get a guild's channels via the REST API. REST mode is required to use this endpoint.
* @returns {Promise<(CategoryChannel[] | TextChannel[] | VoiceChannel[])>}
* @returns {Promise<CategoryChannel[] | TextChannel[] | VoiceChannel[]>}
*/
getRESTChannels() {
return this._client.getRESTGuildChannels.call(this._client, this.id);
Expand Down
2 changes: 1 addition & 1 deletion lib/structures/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ class Message extends Base {

/**
* Delete the message as a webhook
* @param {String} token The token of the webhook
* @arg {String} token The token of the webhook
* @returns {Promise}
*/
deleteWebhook(token) {
Expand Down

0 comments on commit e06f38a

Please sign in to comment.