Skip to content

Commit

Permalink
feat/refactor: Add missing attachment props & with_counts for getREST…
Browse files Browse the repository at this point in the history
…Guild (#1479)

Co-authored-by: Bsian <[email protected]>
  • Loading branch information
conorwastakenwastaken and bsian03 authored Feb 4, 2024
1 parent e54cc76 commit 8a2b212
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
17 changes: 12 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ declare namespace Eris {

// Client
type MembershipStates = Constants["MembershipState"][keyof Constants["MembershipState"]];
type OAuthTeamMemberRoleTypes = Constants["OAuthTeamMemberRoleTypes"][keyof Constants["OAuthTeamMemberRoleTypes"]]
type OAuthTeamMemberRoleTypes = Constants["OAuthTeamMemberRoleTypes"][keyof Constants["OAuthTeamMemberRoleTypes"]];

// Command
type CommandGenerator = CommandGeneratorFunction | MessageContent | MessageContent[] | CommandGeneratorFunction[];
Expand Down Expand Up @@ -1046,6 +1046,7 @@ declare namespace Eris {
after?: string;
before?: string;
limit?: number;
withCounts?: boolean;
}
interface GuildAuditLog {
entries: GuildAuditLogEntry[];
Expand Down Expand Up @@ -1411,13 +1412,16 @@ declare namespace Eris {
}
interface Attachment extends PartialAttachment {
content_type?: string;
duration_secs?: number;
ephemeral?: boolean;
filename: string;
flags?: number;
height?: number;
id: string;
proxy_url: string;
size: number;
url: string;
waveform?: string;
width?: number;
}
interface ButtonBase {
Expand Down Expand Up @@ -1812,6 +1816,9 @@ declare namespace Eris {
USER: 2;
MESSAGE: 3;
};
AttachmentFlags: {
IS_REMIX: 4;
};
AuditLogActions: {
GUILD_UPDATE: 1;

Expand Down Expand Up @@ -2005,11 +2012,11 @@ declare namespace Eris {
GuildOnboardingModes: {
ONBOARDING_DEFAULT: 0;
ONBOARDING_ADVANCED: 1;
}
};
GuildOnboardingPromptTypes: {
MULTIPLE_CHOICE: 0;
DROPDOWN: 1;
}
};
GuildScheduledEventEntityTypes: {
STAGE_INSTANCE: 1;
VOICE: 2;
Expand Down Expand Up @@ -2094,7 +2101,7 @@ declare namespace Eris {
COMPLETED_ONBOARDING: 2;
BYPASSES_VERIFICATION: 4;
STARTED_ONBOARDING: 8;
}
};
MessageActivityTypes: {
JOIN: 1;
SPECTATE: 2;
Expand Down Expand Up @@ -2163,7 +2170,7 @@ declare namespace Eris {
DEVELOPER: "developer";
OWNER: "";
READ_ONLY: "read_only";
}
};
PermissionOverwriteTypes: {
ROLE: 0;
USER: 1;
Expand Down
4 changes: 3 additions & 1 deletion lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3211,7 +3211,8 @@ class Client extends EventEmitter {
* @arg {Object} [options] Options for the request. If this is a number ([DEPRECATED] behavior), it is treated as `options.limit`
* @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 {Number} [options.limit=100] The max number of guilds to get (1 to 200)
* @arg {Boolean} [options.withCounts=false] Whether to include approximate member and presence counts
* @arg {String} [before] [DEPRECATED] The lowest guild ID of the next page
* @arg {String} [after] [DEPRECATED] The highest guild ID of the previous page
* @returns {Promise<Array<Guild>>}
Expand All @@ -3232,6 +3233,7 @@ class Client extends EventEmitter {
if(before !== undefined) {
options.before = before;
}
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
4 changes: 4 additions & 0 deletions lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ module.exports.ApplicationCommandTypes = {
MESSAGE: 3
};

module.exports.AttachmentFlags = {
IS_REMIX: 1 << 2
};

module.exports.AuditLogActions = {
GUILD_UPDATE: 1,

Expand Down

0 comments on commit 8a2b212

Please sign in to comment.