Skip to content

Commit

Permalink
permission + logger fix
Browse files Browse the repository at this point in the history
  • Loading branch information
saiteja-madha committed Mar 23, 2022
1 parent 3c83508 commit abc75f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/helpers/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ const sendLogs = (level, content, data) => {

case "error":
console.log(
`[${chalk.cyan(timestamp)}] [${chalk.redBright(level)}] ${content} ${data ? ": " + inspect(data) : ""}`
`[${chalk.cyan(timestamp)}] [${chalk.redBright(level)}] ${content} ${
data ? ": " + inspect(data.message ?? data) : ""
}`
);
simpleLogger.error(data ? data : content);
simpleLogger.error(data ?? content);
if (errorWebhook) sendWebhook(content, data);
break;

Expand Down
4 changes: 3 additions & 1 deletion src/structures/Command.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ class Command {
* @param {import('discord.js').CommandInteraction} interaction
*/
async executeInteraction(interaction) {
if (!interaction.channel.permissionsFor(interaction.guild.me).has("VIEW_CHANNEL")) return;

// callback validations
for (const validation of this.validations) {
if (!validation.callback(interaction)) {
Expand Down Expand Up @@ -201,7 +203,7 @@ class Command {

// bot permissions
if (this.botPermissions.length > 0) {
if (!interaction.guild.me.permissions.has(this.botPermissions)) {
if (!interaction.channel.permissionsFor(interaction.guild.me).has(this.botPermissions)) {
return interaction.reply({
content: `I need ${parsePermissions(this.botPermissions)} for this command`,
ephemeral: true,
Expand Down

0 comments on commit abc75f8

Please sign in to comment.