Skip to content

Commit

Permalink
Support threads in audit log
Browse files Browse the repository at this point in the history
  • Loading branch information
bsian03 committed Aug 17, 2021
1 parent 3778a27 commit 4e86f70
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ declare namespace Eris {
interface GuildAuditLog {
entries: GuildAuditLogEntry[];
integrations: GuildIntegration[];
threads: AnyThreadChannel[];
users: User[];
webhooks: Webhook[];
}
Expand Down Expand Up @@ -1223,6 +1224,10 @@ declare namespace Eris {
STAGE_INSTANCE_CREATE: 83;
STAGE_INSTANCE_UPDATE: 84;
STAGE_INSTANCE_DELETE: 85;

THREAD_CREATE: 110;
THREAD_UPDATE: 111;
THREAD_DELETE: 112;
};
ChannelTypes: {
GUILD_TEXT: 0;
Expand Down
5 changes: 3 additions & 2 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ class Client extends EventEmitter {
* @arg {String} [options.before] Get entries before this entry ID
* @arg {Number} [options.limit=50] The maximum number of entries to return
* @arg {String} [options.userID] Filter entries by the user that performed the action
* @returns {Promise<{users: User[], entries: GuildAuditLogEntry[], integrations: PartialIntegration[], webhooks: Webhook[]}>}
* @returns {Promise<{entries: GuildAuditLogEntry[], integrations: PartialIntegration[], threads: (NewsThreadChannel | PrivateThreadChannel | PublicThreadChannel)[], users: User[], webhooks: Webhook[]}>}
*/
getGuildAuditLog(guildID, options = {}, before, actionType, userID) {
if(!options || typeof options !== "object") {
Expand Down Expand Up @@ -1842,9 +1842,10 @@ class Client extends EventEmitter {
return this.requestHandler.request("GET", Endpoints.GUILD_AUDIT_LOGS(guildID), true, options).then((data) => {
const guild = this.guilds.get(guildID);
return {
users: data.users.map((user) => this.users.add(user, this)),
entries: data.audit_log_entries.map((entry) => new GuildAuditLogEntry(entry, guild)),
integrations: data.integrations.map((integration) => new GuildIntegration(integration, guild)),
threads: data.threads.map((thread) => guild.threads.update(thread, this)),
users: data.users.map((user) => this.users.add(user, this)),
webhooks: data.webhooks
};
});
Expand Down
6 changes: 5 additions & 1 deletion lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ module.exports.AuditLogActions = {

STAGE_INSTANCE_CREATE: 83,
STAGE_INSTANCE_UPDATE: 84,
STAGE_INSTANCE_DELETE: 85
STAGE_INSTANCE_DELETE: 85,

THREAD_CREATE: 110,
THREAD_UPDATE: 111,
THREAD_DELETE: 112
};

module.exports.MessageActivityTypes = {
Expand Down

0 comments on commit 4e86f70

Please sign in to comment.