rearranged things because my brain is dumb
This commit is contained in:
parent
92d61b1eb8
commit
17f90fcc6a
1 changed files with 35 additions and 35 deletions
|
@ -27,6 +27,10 @@ class Functions {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
intBetween (min, max) {
|
||||||
|
return Math.round((Math.random() * (max - min) + min));
|
||||||
|
}
|
||||||
|
|
||||||
randomColour () {
|
randomColour () {
|
||||||
const n = (Math.random() * 0xfffff * 1000000).toString(16);
|
const n = (Math.random() * 0xfffff * 1000000).toString(16);
|
||||||
|
@ -38,14 +42,14 @@ class Functions {
|
||||||
return roleMap.sort((a, b) => b.position - a.position);
|
return roleMap.sort((a, b) => b.position - a.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
displayHexColour (guild, userID) {
|
findRole (input, guild) {
|
||||||
const roles = this.roleObjects(guild, guild.members.get(userID).roles);
|
let role;
|
||||||
for (const object of roles) {
|
role = guild.roles.find(r => r.name.toLowerCase() === input.toLowerCase());
|
||||||
if (object.color !== 0) return '#' + object.color.toString(16);
|
if (!role) {
|
||||||
|
role = guild.roles.get(input.toLowerCase());
|
||||||
}
|
}
|
||||||
|
if (!role) return;
|
||||||
const colourKeys = Object.keys(colours);
|
return role;
|
||||||
return colours[colourKeys[ colours.length * Math.random() << 0]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
highestRole (member) {
|
highestRole (member) {
|
||||||
|
@ -61,14 +65,14 @@ class Functions {
|
||||||
return highestRole;
|
return highestRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
findRole (input, guild) {
|
displayHexColour (guild, userID) {
|
||||||
let role;
|
const roles = this.roleObjects(guild, guild.members.get(userID).roles);
|
||||||
role = guild.roles.find(r => r.name.toLowerCase() === input.toLowerCase());
|
for (const object of roles) {
|
||||||
if (!role) {
|
if (object.color !== 0) return '#' + object.color.toString(16);
|
||||||
role = guild.roles.get(input.toLowerCase());
|
|
||||||
}
|
}
|
||||||
if (!role) return;
|
|
||||||
return role;
|
const colourKeys = Object.keys(colours);
|
||||||
|
return colours[colourKeys[ colours.length * Math.random() << 0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
checkPermissions (channel, user_id, requiredPerms) {
|
checkPermissions (channel, user_id, requiredPerms) {
|
||||||
|
@ -85,27 +89,6 @@ class Functions {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
intBetween (min, max) {
|
|
||||||
return Math.round((Math.random() * (max - min) + min));
|
|
||||||
}
|
|
||||||
|
|
||||||
shutdown () {
|
|
||||||
const exitQuotes = [
|
|
||||||
'Shutting down.',
|
|
||||||
'I don\'t blame you.',
|
|
||||||
'I don\'t hate you.',
|
|
||||||
'Whyyyyy',
|
|
||||||
'Goodnight.',
|
|
||||||
'Goodbye'
|
|
||||||
];
|
|
||||||
|
|
||||||
this.client.disconnect();
|
|
||||||
|
|
||||||
this.client.logger.success('SHUTDOWN_SUCCESS', exitQuotes.random());
|
|
||||||
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
async getUser (id) {
|
async getUser (id) {
|
||||||
if (this.client.users.has(id)) return this.client.users.get(id);
|
if (this.client.users.has(id)) return this.client.users.get(id);
|
||||||
this.client.logger.debug('REST_FETCH_USER', 'Accessing rest API...');
|
this.client.logger.debug('REST_FETCH_USER', 'Accessing rest API...');
|
||||||
|
@ -153,6 +136,23 @@ class Functions {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shutdown () {
|
||||||
|
const exitQuotes = [
|
||||||
|
'Shutting down.',
|
||||||
|
'I don\'t blame you.',
|
||||||
|
'I don\'t hate you.',
|
||||||
|
'Whyyyyy',
|
||||||
|
'Goodnight.',
|
||||||
|
'Goodbye'
|
||||||
|
];
|
||||||
|
|
||||||
|
this.client.disconnect();
|
||||||
|
|
||||||
|
this.client.logger.success('SHUTDOWN_SUCCESS', exitQuotes.random());
|
||||||
|
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
wait () {
|
wait () {
|
||||||
promisify(setTimeout);
|
promisify(setTimeout);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue