woomy-v2/bot/util/util.js

44 lines
1 KiB
JavaScript
Raw Normal View History

2020-08-18 04:58:36 +00:00
class Util {
constructor (client) {
this.client = client;
}
2020-08-18 08:29:36 +00:00
// Simple check to see if someone is a developer or not
2020-08-18 04:58:36 +00:00
isDeveloper (userID) {
let isDev = false;
const developers = this.client.config.ownerIDs;
developers.forEach(devID => {
if (devID === userID) {
isDev = true;
}
});
console.log(isDev);
return isDev;
}
2020-08-18 08:29:36 +00:00
// Cleans output and removes sensitive information, used by eval
2020-08-18 04:58:36 +00:00
async clean (text) {
if (text && text.constructor.name == "Promise")
text = await text;
if (typeof text !== "string")
text = require("util").inspect(text, { depth: 1 });
text = text
.replace(/`/g, "`" + String.fromCharCode(8203))
.replace(/@/g, "@" + String.fromCharCode(8203))
.replace(this.client.token, "mfa.VkO_2G4Qv3T--NO--lWetW_tjND--TOKEN--QFTm6YGtzq9PH--4U--tG0");
return text;
}
2020-08-18 08:29:36 +00:00
// Return random integer between two given integers
intBetween (min, max) {
return Math.round((Math.random() * (max - min))+min);
}
2020-08-18 04:58:36 +00:00
}
module.exports = Util;