Skip to content

Commit 563ea88

Browse files
committed
some easy stuff to get started (untested)
1 parent 9bfcac4 commit 563ea88

File tree

5 files changed

+48
-1
lines changed

5 files changed

+48
-1
lines changed

additions/Member/hoistColor.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { addPrototype } = require("erisify/helper/prototype");
2+
3+
/**
4+
* @param {import("eris")} Eris
5+
*/
6+
module.exports.init = (Eris) => {
7+
addPrototype(Eris, "Member", function hoistColor() {
8+
const hoistedRole = this.roles.find(item => item.hoist);
9+
10+
return hoistedRole?.color || "#FFFF";
11+
}, true);
12+
};

additions/Member/tag.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { addPrototype } = require("erisify/helper/prototype");
2+
3+
/**
4+
* @param {import("eris")} Eris
5+
*/
6+
module.exports.init = (Eris) => {
7+
addPrototype(Eris, "Member", function tag() {
8+
return `${this.username}#${this.discriminator}`;
9+
}, true);
10+
};

additions/Role/higherThan.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const { addPrototype } = require("erisify/helper/prototype");
2+
3+
/**
4+
* @param {import("eris")} Eris
5+
*/
6+
module.exports.init = (Eris) => {
7+
addPrototype(Eris, "Role", function higherThan(roleTwo) {
8+
// If both roles have the same position then use id's (the lower the id the older it is, so lets return true if it's older)
9+
if (this.position === roleTwo.position) return this.id < roleTwo.id;
10+
11+
return this.position > roleTwo.position;
12+
}, true);
13+
};

additions/Role/isHighest.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { addPrototype } = require("erisify/helper/prototype");
2+
3+
/**
4+
* @param {import("eris")} Eris
5+
*/
6+
module.exports.init = (Eris) => {
7+
addPrototype(Eris, "Role", function isHighest() {
8+
const highestRole = Math.max.apply(Math, array.map(item => item.position));
9+
10+
return highestRole.id === this.id;
11+
}, true);
12+
};

additions/User/tag.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { addPrototype } = require("erisify/helper/prototype");
44
* @param {import("eris")} Eris
55
*/
66
module.exports.init = (Eris) => {
7-
addPrototype(Eris, "User", function guild() {
7+
addPrototype(Eris, "User", function tag() {
88
return `${this.username}#${this.discriminator}`;
99
}, true);
1010
};

0 commit comments

Comments
 (0)