comments
This commit is contained in:
12
dist/util/discord.js
vendored
12
dist/util/discord.js
vendored
@@ -5,9 +5,7 @@ const discord_js_1 = require("discord.js");
|
||||
const main_1 = require("./main");
|
||||
/**
|
||||
* get the GuildMember of an interaction
|
||||
* @param interaction
|
||||
* @throws errorMessage class if it cannot be read
|
||||
* @returns member
|
||||
*/
|
||||
function getMember(interaction) {
|
||||
const member = interaction.member;
|
||||
@@ -18,9 +16,7 @@ function getMember(interaction) {
|
||||
exports.getMember = getMember;
|
||||
/**
|
||||
* get the TextChannel of an interaction
|
||||
* @param interaction
|
||||
* @throws errorMessage class if it cannot be read
|
||||
* @returns member
|
||||
*/
|
||||
function getChannel(interaction) {
|
||||
const channel = interaction.channel;
|
||||
@@ -29,11 +25,19 @@ function getChannel(interaction) {
|
||||
return channel;
|
||||
}
|
||||
exports.getChannel = getChannel;
|
||||
/**
|
||||
* get the TextChannel of an interaction
|
||||
* @throws errorMessage class if the Member cannot be read
|
||||
*/
|
||||
function memberIsMod(interaction) {
|
||||
const member = getMember(interaction);
|
||||
return member.permissionsIn(interaction.channelId).has('MANAGE_MESSAGES');
|
||||
}
|
||||
exports.memberIsMod = memberIsMod;
|
||||
/**
|
||||
* get the TextChannel of an interaction
|
||||
* @throws errorMessage class if the Member cannot be read or if Member is not a mod
|
||||
*/
|
||||
function memberIsModThrow(interaction) {
|
||||
if (!memberIsMod(interaction))
|
||||
throw (0, main_1.emsg)('discord.notMod');
|
||||
|
||||
Reference in New Issue
Block a user