simple-discord-bot.js 0.1.2 → 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.2",
3
+ "version": "0.1.3",
4
4
  "description": "A simple Discord bot library",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -16,7 +16,12 @@ class EmbedBuilder {
16
16
  setColor(color) {
17
17
  if (typeof color === "string") {
18
18
  color = color.replace("#", "")
19
- color = parseInt(color, 16)
19
+
20
+ if (/^[0-9a-fA-F]{6}$/.test(color)) {
21
+ color = parseInt(color, 16)
22
+ } else {
23
+ color = 0
24
+ }
20
25
  }
21
26
 
22
27
  this.data.color = color
@@ -28,11 +33,47 @@ class EmbedBuilder {
28
33
  return this
29
34
  }
30
35
 
31
- setFooter(text) {
36
+ setFooter(text, iconURL = null) {
32
37
  this.data.footer = {
33
38
  text: text
34
39
  }
35
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
+
36
77
  return this
37
78
  }
38
79