simple-discord-bot.js 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-discord-bot.js",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A simple Discord bot library",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -13,4 +13,4 @@
13
13
  "dependencies": {
14
14
  "ws": "^8.18.3"
15
15
  }
16
- }
16
+ }
@@ -14,6 +14,16 @@ class EmbedBuilder {
14
14
  }
15
15
 
16
16
  setColor(color) {
17
+ if (typeof color === "string") {
18
+ color = color.replace("#", "")
19
+
20
+ if (/^[0-9a-fA-F]{6}$/.test(color)) {
21
+ color = parseInt(color, 16)
22
+ } else {
23
+ color = 0
24
+ }
25
+ }
26
+
17
27
  this.data.color = color
18
28
  return this
19
29
  }
@@ -23,11 +33,47 @@ class EmbedBuilder {
23
33
  return this
24
34
  }
25
35
 
26
- setFooter(text) {
36
+ setFooter(text, iconURL = null) {
27
37
  this.data.footer = {
28
38
  text: text
29
39
  }
30
40
 
41
+ if (iconURL) {
42
+ this.data.footer.icon_url = iconURL
43
+ }
44
+
45
+ return this
46
+ }
47
+
48
+ setAuthor(name, iconURL = null, url = null) {
49
+ this.data.author = {
50
+ name: name
51
+ }
52
+
53
+ if (iconURL) {
54
+ this.data.author.icon_url = iconURL
55
+ }
56
+
57
+ if (url) {
58
+ this.data.author.url = url
59
+ }
60
+
61
+ return this
62
+ }
63
+
64
+ setThumbnail(url) {
65
+ this.data.thumbnail = {
66
+ url: url
67
+ }
68
+
69
+ return this
70
+ }
71
+
72
+ setImage(url) {
73
+ this.data.image = {
74
+ url: url
75
+ }
76
+
31
77
  return this
32
78
  }
33
79