diff --git a/src/events.js b/src/events.js index e1ac05b..e5cdb99 100644 --- a/src/events.js +++ b/src/events.js @@ -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; diff --git a/src/structures/GenericPager.js b/src/structures/GenericPager.js index 1e96807..d95dfb1 100644 --- a/src/structures/GenericPager.js +++ b/src/structures/GenericPager.js @@ -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); } /** diff --git a/src/structures/Paginator.js b/src/structures/Paginator.js index e4c75d4..2dbf33e 100644 --- a/src/structures/Paginator.js +++ b/src/structures/Paginator.js @@ -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); } /** diff --git a/src/util.js b/src/util.js index ad515d4..46d5c78 100644 --- a/src/util.js +++ b/src/util.js @@ -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) => {