Skip to content

Commit

Permalink
✨ Add : Utils
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaCoderr authored Jul 10, 2021
1 parent e41a42e commit 9e95111
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Utils/Global.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
global.toID = function (text) {
if (typeof text === 'string') return text.toLowerCase().replace(/[^a-z0-9]/g, '');
}


global.config = require('../Configs/config');
global.emotes = require('../Configs/emotes')
global.filters = require('../Configs/filters')
35 changes: 35 additions & 0 deletions Utils/Logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const chalk = require('chalk');
const util = require('util');

const append = (m) => {
const message = `[${new Date().toLocaleDateString()}] | ${m}`;
return typeof message === "string" ? message : util.inspect(message);
}

global.logger = {
log: message => {
console.log(chalk.whiteBright(append((message))));
},

error: message => {
console.log(chalk.redBright(append((message))));
},

warn: message => {
console.log(chalk.magentaBright(append((message))));
},

info: message => {
console.log(chalk.blueBright(append((message))));
},

success: message => {
console.log(chalk.greenBright(append((message))));
},

debug: message => {
console.log(chalk.yellowBright(append((message))));
},
};

module.exports.logger = logger;

0 comments on commit 9e95111

Please sign in to comment.