Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!msg.content.startsWith(prefix)) {
return;
}
const [ commandName, ...args ] = msg.content.slice(prefix.length).split(/ +/g);
const command = this.commands.get(this.commandTriggers.get(commandName));
if (
!command || (
command.props.ownerOnly && msg.author.id !== process.env.BOT_OWNER_ID
)) {
return;
}
const permissions = msg.channel.guild
? msg.channel.permissionsOf(this.user.id)
: new Permission(383040); // DM channels
if (!permissions.has('sendMessages')) {
return;
}
command
._execute(msg, args)
.catch(err => {
console.error(err);
return {
title: '⚠ Something went wrong while executing this command.',
color: 0xFF0000,
description: codeblock(
err.message + (
err.body && err.body.error
function permissionsListFromNumber(permissions) {
return arrayOfTrues(new Eris.Permission(permissions).json).toString();
}
public permissionsOf(memberID: string): Permission {
return new Permission(0b1111111111111111111111111111111, 0);
}
}