Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Interaction): add memberPermissions #6741

Merged
merged 7 commits into from Oct 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -1032,6 +1032,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