Skip to content

Commit 39d3936

Browse files
authored
Merge pull request #1 from Exhabition/development
Add stabilish stuff to main
2 parents c6c919b + 9f754fb commit 39d3936

File tree

9 files changed

+210
-3
lines changed

9 files changed

+210
-3
lines changed

additions/Eris/MessageButton.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class MessageButton {
2+
constructor() {
3+
this.useful = true;
4+
5+
return this;
6+
}
7+
}
8+
9+
module.exports = Eris => {
10+
Eris.MessageButton = MessageButton;
11+
};

additions/Eris/MessageEmbed.js

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
class MessageEmbed {
2+
constructor() {
3+
this.fields = [];
4+
5+
return this;
6+
}
7+
8+
setAuthor(name, icon_url, url) {
9+
this.author = { name, icon_url, url };
10+
11+
return this;
12+
}
13+
14+
setColor(color) {
15+
if (color.startsWith("#")) this.color = parseInt(color, 16);
16+
else this.color = color;
17+
18+
return this;
19+
}
20+
21+
setTitle(title) {
22+
this.title = title.toString().slice(256);
23+
24+
return this;
25+
}
26+
27+
setUrl(url) {
28+
this.url = url;
29+
30+
return this;
31+
}
32+
33+
setDescription(description) {
34+
this.description = description.toString().slice(2048);
35+
36+
return this;
37+
}
38+
39+
setThumbnail(url) {
40+
this.thumbnail = { url };
41+
42+
return this;
43+
}
44+
45+
setImage(url) {
46+
this.image = { url };
47+
48+
return this;
49+
}
50+
51+
setTimestamp(time = new Date()) {
52+
this.timestamp = time;
53+
54+
return this;
55+
}
56+
57+
setFooter(text, icon_url) {
58+
this.footer = { text: text.toString().slice(2048), icon_url };
59+
60+
return this;
61+
}
62+
63+
addField(name, value, inline = false) {
64+
if (this.fields.length >= 25) {
65+
console.warn("Limit of 25 fields exceeded, no field was added");
66+
return this;
67+
} else if (!name || !value) {
68+
console.warn("Both a name & value are needed, no field was addded");
69+
return this;
70+
}
71+
72+
this.fields.push({ name: toString().slice(256), value: value.toString().slice(256), inline });
73+
}
74+
75+
clearFields() {
76+
this.fields = [];
77+
}
78+
}
79+
80+
module.exports = Eris => {
81+
Eris.MessageEmbed = MessageEmbed;
82+
};

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
};

package.json

+8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/Exhabition/erisify.git"
12+
},
13+
"bugs": {
14+
"url": "https://github.com/Exhabition/erisify/issues"
15+
},
16+
"homepage": "https://github.com/Exhabition/erisify#readme",
917
"peerDependencies": {
1018
"eris": ">=0.15.0"
1119
},

readme.md

+61-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,61 @@
1-
# erisify
2-
dank package which i made just because i am lazy
1+
# 🌸 erisify 🌸
2+
3+
🌹 uwu eris but a few extwa thingies uwu 🌹
4+
5+
<br>how to use?1!?
6+
7+
```js
8+
const Eris = require("eris");
9+
require("erisify")(Eris);
10+
```
11+
12+
🌺 owo more advanced owo 🌺
13+
14+
```js
15+
const Eris = require("eris");
16+
require("erisify")(Eris, { disabled: ["Message.tag"] });
17+
```
18+
19+
# teh thingies
20+
21+
## Message
22+
23+
🌸 `guild` - Shortcute of `message.channel.guild`
24+
25+
## User
26+
27+
🌸 `tag` - Combines teh `User.username` & `User.discriminator`
28+
29+
# options yay
30+
31+
🏵️ `enabled` - When `enabled` contains 1 or more specific items, only those are enabled, other additions will then be disabled.
32+
<br>[Default = `"all"`]
33+
34+
🏵️ `disabled` - Disabled specific additions while all other additions stay enabled
35+
<br>[Default = `"none"`]
36+
37+
🏵️ `logging` - Either `true` or `false`
38+
<br>[Default = `false`]
39+
40+
## examples
41+
42+
the following example will _only_ enable `Message.tag` and disable all other additions. Also disables logging.
43+
44+
```js
45+
const Eris = require("eris");
46+
require("erisify")(Eris, { enabled: ["Message.tag"] }, false);
47+
```
48+
49+
the following example will _only_ disable `Message.tag` and enable all other additions. Also enables logging.
50+
51+
```js
52+
const Eris = require("eris");
53+
require("erisify")(Eris, { disabled: ["Message.tag"] }, true);
54+
```
55+
56+
## todo
57+
- [ ] fixy like the entire package owo
58+
- [ ] add useful stuff
59+
60+
## credits
61+
package inspired by `bsian03's` [pluris](https://github.com/bsian03/pluris) package

0 commit comments

Comments
 (0)