Skip to content

Commit

Permalink
feat(Client): support with_counts parameter in getRESTGuilds()
Browse files Browse the repository at this point in the history
  • Loading branch information
TTtie committed Jul 14, 2023
1 parent a5d81e5 commit 5105d60
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ declare namespace Dysnomia {
after?: string;
before?: string;
limit?: number;
withCounts?: boolean;
}
interface GuildAuditLog {
autoModerationRules: AutoModerationRule[];
Expand Down
2 changes: 2 additions & 0 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2617,13 +2617,15 @@ class Client extends EventEmitter {
* @arg {String} [options.after] The highest guild ID of the previous page
* @arg {String} [options.before] The lowest guild ID of the next page
* @arg {Number} [options.limit=100] The max number of guilds to get (1 to 1000)
* @arg {Boolean} [options.withCounts] Whether the guild objects will have approximateMemberCount and approximatePresenceCount
* @returns {Promise<Array<Guild>>}
*/
getRESTGuilds(options = {}) {
// TODO type
if(!this.options.restMode) {
return Promise.reject(new Error("Dysnomia REST mode is not enabled"));
}
options.with_counts = options.withCounts;
return this.requestHandler.request("GET", Endpoints.USER_GUILDS("@me"), true, options).then((guilds) => guilds.map((guild) => new Guild(guild, this)));
}

Expand Down

0 comments on commit 5105d60

Please sign in to comment.