rearranged things because my brain is dumb

This commit is contained in:
Emily 2021-03-03 10:43:59 +11:00
parent 92d61b1eb8
commit 17f90fcc6a
1 changed files with 35 additions and 35 deletions

View File

@ -27,6 +27,10 @@ class Functions {
return false;
}
}
intBetween (min, max) {
return Math.round((Math.random() * (max - min) + min));
}
randomColour () {
const n = (Math.random() * 0xfffff * 1000000).toString(16);
@ -38,14 +42,14 @@ class Functions {
return roleMap.sort((a, b) => b.position - a.position);
}
displayHexColour (guild, userID) {
const roles = this.roleObjects(guild, guild.members.get(userID).roles);
for (const object of roles) {
if (object.color !== 0) return '#' + object.color.toString(16);
findRole (input, guild) {
let role;
role = guild.roles.find(r => r.name.toLowerCase() === input.toLowerCase());
if (!role) {
role = guild.roles.get(input.toLowerCase());
}
const colourKeys = Object.keys(colours);
return colours[colourKeys[ colours.length * Math.random() << 0]];
if (!role) return;
return role;
}
highestRole (member) {
@ -61,14 +65,14 @@ class Functions {
return highestRole;
}
findRole (input, guild) {
let role;
role = guild.roles.find(r => r.name.toLowerCase() === input.toLowerCase());
if (!role) {
role = guild.roles.get(input.toLowerCase());
displayHexColour (guild, userID) {
const roles = this.roleObjects(guild, guild.members.get(userID).roles);
for (const object of roles) {
if (object.color !== 0) return '#' + object.color.toString(16);
}
if (!role) return;
return role;
const colourKeys = Object.keys(colours);
return colours[colourKeys[ colours.length * Math.random() << 0]];
}
checkPermissions (channel, user_id, requiredPerms) {
@ -85,27 +89,6 @@ class Functions {
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) {
if (this.client.users.has(id)) return this.client.users.get(id);
this.client.logger.debug('REST_FETCH_USER', 'Accessing rest API...');
@ -153,6 +136,23 @@ class Functions {
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 () {
promisify(setTimeout);
}