simple-discord-bot.js 0.1.0 → 0.1.1

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/client.js CHANGED
@@ -104,14 +104,25 @@ class Client extends EventEmitter {
104
104
  options: {},
105
105
 
106
106
  reply: content => {
107
+ const messageData = {}
108
+
109
+ if (typeof content === "string") {
110
+ messageData.content = content
111
+ } else if (
112
+ content &&
113
+ typeof content.toJSON === "function"
114
+ ) {
115
+ messageData.embeds = [content.toJSON()]
116
+ } else if (content && typeof content === "object") {
117
+ Object.assign(messageData, content)
118
+ }
119
+
107
120
  return this.api.request(
108
121
  "POST",
109
122
  `/interactions/${data.id}/${data.token}/callback`,
110
123
  {
111
124
  type: 4,
112
- data: {
113
- content: content
114
- }
125
+ data: messageData
115
126
  }
116
127
  )
117
128
  }
package/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  const Client = require("./client")
2
+ const EmbedBuilder = require("./structures/EmbedBuilder")
2
3
 
3
4
  module.exports = {
4
- Client
5
+ Client,
6
+ EmbedBuilder
5
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simple-discord-bot.js",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A simple Discord bot library",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
@@ -0,0 +1,44 @@
1
+ class EmbedBuilder {
2
+ constructor() {
3
+ this.data = {}
4
+ }
5
+
6
+ setTitle(title) {
7
+ this.data.title = title
8
+ return this
9
+ }
10
+
11
+ setDescription(description) {
12
+ this.data.description = description
13
+ return this
14
+ }
15
+
16
+ setColor(color) {
17
+ this.data.color = color
18
+ return this
19
+ }
20
+
21
+ setURL(url) {
22
+ this.data.url = url
23
+ return this
24
+ }
25
+
26
+ setFooter(text) {
27
+ this.data.footer = {
28
+ text: text
29
+ }
30
+
31
+ return this
32
+ }
33
+
34
+ setTimestamp() {
35
+ this.data.timestamp = new Date().toISOString()
36
+ return this
37
+ }
38
+
39
+ toJSON() {
40
+ return this.data
41
+ }
42
+ }
43
+
44
+ module.exports = EmbedBuilder