mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
feat(Interaction): add memberPermissions (#6741)
Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const Base = require('./Base');
|
const Base = require('./Base');
|
||||||
const { InteractionTypes, MessageComponentTypes } = require('../util/Constants');
|
const { InteractionTypes, MessageComponentTypes } = require('../util/Constants');
|
||||||
|
const Permissions = require('../util/Permissions');
|
||||||
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
const SnowflakeUtil = require('../util/SnowflakeUtil');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,6 +68,12 @@ class Interaction extends Base {
|
|||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
this.version = data.version;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -1056,6 +1056,7 @@ export class Interaction extends Base {
|
|||||||
public type: InteractionType;
|
public type: InteractionType;
|
||||||
public user: User;
|
public user: User;
|
||||||
public version: number;
|
public version: number;
|
||||||
|
public memberPermissions: Readonly<Permissions> | null;
|
||||||
public inGuild(): this is this & {
|
public inGuild(): this is this & {
|
||||||
guildId: Snowflake;
|
guildId: Snowflake;
|
||||||
member: GuildMember | APIInteractionGuildMember;
|
member: GuildMember | APIInteractionGuildMember;
|
||||||
|
|||||||
Reference in New Issue
Block a user