text: module.exports = (client) => {
  
    client.permlevel = message => {
      let permlvl = 0;
  
  
      if (message.author.id === client.config.ownerID) return 10;
  
  
      if (!message.guild || !message.member) return 0;
  
  
      try {
        const modRole = message.guild.roles.find(r => r.name.toLowerCase() === message.settings.modRole.toLowerCase());
        if (modRole && message.member.roles.has(modRole.id)) permlvl = 2;
      } catch (e) {
        console.warn("modRole not present in guild settings. Skipping Moderator (level 2) check");
      }
      try {
        const adminRole = message.guild.roles.find(r => r.name.toLowerCase() === message.settings.adminRole.toLowerCase());
        if (adminRole && message.member.roles.has(adminRole.id)) permlvl = 3;
      } catch (e) {
        console.warn("adminRole not present in guild settings. Skipping Administrator (level 3) check");
      }
  
      if (message.author.id === message.guild.owner.id) permlvl = 4;
  
      return permlvl;
    };
  
  
   
    client.log = (type, msg, title) => {
      if (!title) title = "Log";
      console.log(`[${type}] [${title}] ${msg}`);
    };
  
  
    client.awaitReply = async (msg, question, limit = 60000) => {
      const filter = m=>m.author.id = msg.author.id;
      await msg.channel.send(question);
      try {
        const collected = await msg.channel.awaitMessages(filter, { max: 1, time: limit, errors: ["time"] });
        return collected.first().content;
      } catch (e) {
        return false;
      }
    };
  
  
    client.clean = async (client, text) => {
      if (text && text.constructor.name == "Promise")
        text = await text;
      if (typeof evaled !== "string")
        text = require("util").inspect(text, {depth: 0});
  
      text = text
        .replace(/`/g, "`" + String.fromCharCode(8203))
        .replace(/@/g, "@" + String.fromCharCode(8203))
        .replace(client.token, "mfa.VkO_2G4Qv3T--NO--lWetW_tjND--TOKEN--QFTm6YGtzq9PH--4U--tG0");
  
      return text;
    };
  
  
  
    String.prototype.toProperCase = function() {
      return this.replace(/([^\W_]+[^\s-]*) */g, function(txt) {return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
    };
  
  
    client.wait = require("util").promisify(setTimeout);
  
  
    process.on("uncaughtException", (err) => {
      const errorMsg = err.stack.replace(new RegExp(`${__dirname}/`, "g"), "./");
      console.error("Uncaught Exception: ", errorMsg);
    });
  
    process.on("unhandledRejection", err => {
      console.error("Uncaught Promise Error: ", err);
    });
  };
  