fix: fix perms again

This commit is contained in:
Snazzah 2022-11-14 15:58:25 -06:00
parent ad1fa34f5b
commit 536495e83b
No known key found for this signature in database
GPG key ID: EA479766A94CEB61
4 changed files with 11 additions and 7 deletions

View file

@ -1,6 +1,7 @@
const ArgumentInterpreter = require('./structures/ArgumentInterpreter');
const Util = require('./util');
const config = require('config');
const { Permissions } = require('oceanic.js');
module.exports = class Events {
constructor(client) {
@ -14,7 +15,7 @@ module.exports = class Events {
// Check to see if bot can send messages
if (message.channel.type !== 1 &&
!message.channel.permissionsOf(this.client.user.id).has('SEND_MESSAGES')) return;
!message.channel.permissionsOf(this.client.user.id).has(Permissions.SEND_MESSAGES)) return;
// Message awaiter
if (this.client.messageAwaiter.processHalt(message)) return;

View file

@ -1,6 +1,7 @@
const Paginator = require('./Paginator');
const lodash = require('lodash');
const config = require('config');
const { Permissions } = require('oceanic.js');
/**
* A generic pager that shows a list of items
@ -38,7 +39,7 @@ class GenericPager extends Paginator {
*/
canEmbed() {
return this.message.channel.type === 1 ||
this.message.channel.permissionsOf(this.client.user.id).has('EMBED_LINKS');
this.message.channel.permissionsOf(this.client.user.id).has(Permissions.EMBED_LINKS);
}
/**

View file

@ -1,4 +1,5 @@
const EventEmitter = require('eventemitter3');
const { Permissions } = require('oceanic.js');
/**
* A class that creates a paging process for messages
@ -87,7 +88,7 @@ class Paginator extends EventEmitter {
*/
canPaginate() {
return this.message.channel.type === 1 ||
this.message.channel.permissionsOf(this.client.user.id).has('ADD_REACTIONS');
this.message.channel.permissionsOf(this.client.user.id).has(Permissions.ADD_REACTIONS);
}
/**
@ -96,7 +97,7 @@ class Paginator extends EventEmitter {
*/
canManage() {
return this.message.channel.type !== 1 &&
this.message.channel.permissionsOf(this.client.user.id).has('MANAGE_MESSAGES');
this.message.channel.permissionsOf(this.client.user.id).has(Permissions.MANAGE_MESSAGES);
}
/**

View file

@ -2,6 +2,7 @@ const fetch = require('node-fetch');
const config = require('config');
const fs = require('fs');
const path = require('path');
const { Permissions } = require('oceanic.js');
/**
* Represents the utilities for the bot
@ -60,11 +61,11 @@ Util.Prefix = {
*/
Util.CommandPermissions = {
attach: (client, message) => message.channel.type === 1 ||
message.channel.permissionsOf(client.user.id).has('ATTACH_FILES'),
message.channel.permissionsOf(client.user.id).has(Permissions.ATTACH_FILES),
embed: (client, message) => message.channel.type === 1 ||
message.channel.permissionsOf(client.user.id).has('EMBED_LINKS'),
message.channel.permissionsOf(client.user.id).has(Permissions.EMBED_LINKS),
emoji: (client, message) => message.channel.type === 1 ||
message.channel.permissionsOf(client.user.id).has('USE_EXTERNAL_EMOJIS'),
message.channel.permissionsOf(client.user.id).has(Permissions.USE_EXTERNAL_EMOJIS),
guild: (_, message) => !!message.guildID,
elevated: (_, message) => config.elevated.includes(message.author.id),
curator: (client, message) => {