rename helpers.js to functions
This commit is contained in:
		
							parent
							
								
									b07dd003ed
								
							
						
					
					
						commit
						d194940e2b
					
				
					 5 changed files with 14 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -21,7 +21,7 @@ module.exports = class {
 | 
			
		|||
        if (!action || action.toLowerCase() === 'list') {
 | 
			
		||||
            const list = [];
 | 
			
		||||
            for (const userID of data.guild.blocklist) {
 | 
			
		||||
                const user = await client.helpers.getUser(userID);
 | 
			
		||||
                const user = await client.functions.getUser(userID);
 | 
			
		||||
                list.push(`${user.username}#${user.discriminator}`);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -60,7 +60,7 @@ module.exports = class {
 | 
			
		|||
                `${client.constants.emojis.userError} You can't block the owner, silly!`
 | 
			
		||||
            );
 | 
			
		||||
            
 | 
			
		||||
            if (client.helpers.highestRole(member).position >= client.helpers.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) {
 | 
			
		||||
            if (client.functions.highestRole(member).position >= client.functions.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) {
 | 
			
		||||
                return message.channel.createMessage(`${client.constants.emojis.userError} This user has a higher role than you, you can't add them to the blocklist!`);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +81,7 @@ module.exports = class {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        if (action === 'remove') {            
 | 
			
		||||
            if (client.helpers.highestRole(member).position >= client.helpers.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) {
 | 
			
		||||
            if (client.functions.highestRole(member).position >= client.functions.highestRole(message.member).position && message.member.id !== message.channel.guild.ownerID) {
 | 
			
		||||
                return message.channel.createMessage(`${client.constants.emojis.userError} This user has a higher role than you, you can't remove them to the blocklist!`);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,14 +19,14 @@ module.exports = class {
 | 
			
		|||
        const code = args.join(' ');
 | 
			
		||||
        try {
 | 
			
		||||
            const evaled = eval(code);
 | 
			
		||||
            const clean = await client.helpers.clean(evaled);
 | 
			
		||||
            const clean = await client.functions.clean(evaled);
 | 
			
		||||
            const MAX_CHARS = 3 + 2 + clean.length + 3;
 | 
			
		||||
            if (MAX_CHARS > 2000) {
 | 
			
		||||
                return message.channel.createMessage(undefined, { file: Buffer.from(clean), name:  'EVAL_SUCCESS.txt' });
 | 
			
		||||
                return message.channel.createMessage(undefined, { file: Buffer.from(clean), name:  'EVAL_SUCCESS.js' });
 | 
			
		||||
            }
 | 
			
		||||
            message.channel.createMessage(`\`\`\`js\n${clean}\n\`\`\``);
 | 
			
		||||
        } catch (err) {
 | 
			
		||||
            const e = await client.helpers.clean(err);
 | 
			
		||||
            const e = await client.functions.clean(err);
 | 
			
		||||
            const MAX_CHARS = 3 + 2 + e.length + 3;
 | 
			
		||||
            if (MAX_CHARS > 2000) {
 | 
			
		||||
                return message.channel.createMessage(undefined, { file: Buffer.from(e), name: 'EVAL_ERROR.txt' });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ const CommandLoader = require('./util/commandLoader');
 | 
			
		|||
const EventLoader = require('./util/eventLoader');
 | 
			
		||||
const EventHandler = require('./util/handlers/eventHandler');
 | 
			
		||||
const MessageHandler = require('./util/handlers/messageHandler');
 | 
			
		||||
const Helpers = require('./util/helpers');
 | 
			
		||||
const Functions = require('./util/functions');
 | 
			
		||||
const Database = require('./util/database');
 | 
			
		||||
const Logger = require('./util/logger');
 | 
			
		||||
const sentry = require('@sentry/node');
 | 
			
		||||
| 
						 | 
				
			
			@ -27,7 +27,7 @@ class WoomyClient extends Eris.Client {
 | 
			
		|||
        this.constants = constants;
 | 
			
		||||
        this.logger = Logger;
 | 
			
		||||
        this.db = new Database(this);
 | 
			
		||||
        this.helpers = new Helpers(this);
 | 
			
		||||
        this.functions = new Functions(this);
 | 
			
		||||
        this.commandLoader = new CommandLoader(this);
 | 
			
		||||
        this.eventLoader = new EventLoader(this);
 | 
			
		||||
        this.eventHandler = new EventHandler(this);
 | 
			
		||||
| 
						 | 
				
			
			@ -100,7 +100,7 @@ class WoomyClient extends Eris.Client {
 | 
			
		|||
const client = new WoomyClient(config.token, { 
 | 
			
		||||
    maxShards: 'auto',
 | 
			
		||||
    restMode: true,
 | 
			
		||||
    getAllUsers: true,
 | 
			
		||||
    //getAllUsers: true,
 | 
			
		||||
    defaultImageSize: 2048,
 | 
			
		||||
    intents: [
 | 
			
		||||
        'guilds',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
// const { MessageCollector } = require('eris-collector');
 | 
			
		||||
const { inspect, promisify } = require('util');
 | 
			
		||||
 | 
			
		||||
class Helpers {
 | 
			
		||||
class Functions {
 | 
			
		||||
    constructor (client) {
 | 
			
		||||
        this.client = client;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -144,4 +144,4 @@ class Helpers {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = Helpers;
 | 
			
		||||
module.exports = Functions;
 | 
			
		||||
| 
						 | 
				
			
			@ -65,12 +65,12 @@ class MessageHandler {
 | 
			
		|||
        );
 | 
			
		||||
 | 
			
		||||
        // Both of these blocks check the permissions of the user, and reply with missing perms if any are found
 | 
			
		||||
        const missingUserPerms = this.client.helpers.checkPermissions(message.channel, message.author.id, command.userPerms);
 | 
			
		||||
        const missingUserPerms = this.client.functions.checkPermissions(message.channel, message.author.id, command.userPerms);
 | 
			
		||||
        if (missingUserPerms) return message.channel.createMessage(
 | 
			
		||||
            `${this.client.constants.emojis.permError} You can't use this command because you lack these permissions: \`${missingUserPerms.join('`, `')}\``
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        const missingBotPerms = this.client.helpers.checkPermissions(message.channel, this.client.user.id, command.botPerms);
 | 
			
		||||
        const missingBotPerms = this.client.functions.checkPermissions(message.channel, this.client.user.id, command.botPerms);
 | 
			
		||||
        if (missingBotPerms) return message.channel.createMessage(
 | 
			
		||||
            `${this.client.constants.emojis.permError} I can't run this command because I lack these permissions: \`${missingBotPerms.join('`, `')}\``
 | 
			
		||||
        );
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +81,7 @@ class MessageHandler {
 | 
			
		|||
        );
 | 
			
		||||
        
 | 
			
		||||
        // Return if the command is restricted to developers (and the user is not a developer)
 | 
			
		||||
        if (command.devOnly === true && this.client.helpers.isDeveloper(message.author.id) !== true) {
 | 
			
		||||
        if (command.devOnly === true && this.client.functions.isDeveloper(message.author.id) !== true) {
 | 
			
		||||
            return message.channel.createMessage(
 | 
			
		||||
                this.client.constants.emojis.permError + ' This command\'s usage is restricted to developers only. Sorry!'
 | 
			
		||||
            );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue