Skip to content

Commit

Permalink
feat(Interaction): add memberPermissions (#6741)
Browse files Browse the repository at this point in the history
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
  • Loading branch information
3 people committed Oct 3, 2021
1 parent 3eacf7a commit 28d96e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/structures/Interaction.js
Expand Up @@ -2,6 +2,7 @@

const Base = require('./Base');
const { InteractionTypes, MessageComponentTypes } = require('../util/Constants');
const Permissions = require('../util/Permissions');
const SnowflakeUtil = require('../util/SnowflakeUtil');

/**
Expand Down Expand Up @@ -67,6 +68,12 @@ class Interaction extends Base {
* @type {number}
*/
this.version = data.version;

/**
* The permissions of the member, if one exists, in the channel this interaction was executed in
* @type {?Readonly<Permissions>}
*/
this.memberPermissions = data.member?.permissions ? new Permissions(data.member.permissions).freeze() : null;
}

/**
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Expand Up @@ -1056,6 +1056,7 @@ export class Interaction extends Base {
public type: InteractionType;
public user: User;
public version: number;
public memberPermissions: Readonly<Permissions> | null;
public inGuild(): this is this & {
guildId: Snowflake;
member: GuildMember | APIInteractionGuildMember;
Expand Down

0 comments on commit 28d96e3

Please sign in to comment.