From fcdffcf623d2e1a24fa02d232e60623a151c7c08 Mon Sep 17 00:00:00 2001 From: Lewdcario Date: Thu, 1 Mar 2018 20:47:18 -0600 Subject: [PATCH] docs: improvements & examples --- src/structures/ClientUser.js | 10 ++++++++++ src/structures/Guild.js | 6 +++++- src/structures/GuildChannel.js | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/structures/ClientUser.js b/src/structures/ClientUser.js index adb0ae3aa..ed59c67ea 100644 --- a/src/structures/ClientUser.js +++ b/src/structures/ClientUser.js @@ -174,6 +174,11 @@ class ClientUser extends User { * Sets the full presence of the client user. * @param {PresenceData} data Data for the presence * @returns {Promise} + * @example + * // Set the client user's presence + * client.user.setPresence({ game: { name: 'with discord.js' }, status: 'idle' }) + * .then(console.log) + * .catch(console.error); */ setPresence(data) { // {"op":3,"d":{"status":"dnd","since":0,"game":null,"afk":false}} @@ -241,6 +246,11 @@ class ClientUser extends User { * Sets the status of the client user. * @param {PresenceStatus} status Status to change to * @returns {Promise} + * @example + * // Set the client user's status + * client.user.setStatus('idle') + * .then(console.log) + * .catch(console.error); */ setStatus(status) { return this.setPresence({ status }); diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 4284fc990..5556a2f42 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -441,10 +441,14 @@ class Guild { /** * Fetch a collection of banned users in this guild. * @returns {Promise>} + * @example + * // Fetch bans in guild + * guild.fetchBans() + * .then(bans => console.log(`This guild has ${bans.size} bans`)) + * .catch(console.error); */ fetchBans() { return this.client.rest.methods.getGuildBans(this) - // This entire re-mapping can be removed in the next major release .then(bans => { const users = new Collection(); for (const ban of bans.values()) users.set(ban.user.id, ban.user); diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 37196caf6..735ce3bd9 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -263,7 +263,7 @@ class GuildChannel extends Channel { /** * Set a new parent for the guild channel. - * @param {GuildChannel|SnowFlake} parent The new parent for the guild channel + * @param {CategoryChannel|SnowFlake} parent The new parent for the guild channel * @param {string} [reason] Reason for changing the guild channel's parent * @returns {Promise} * @example