circledisc
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "circledisc", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "CircleCI > Discord webhook", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# CircleDisc | ||
CircleCI > Discord webhook | ||
CircleCI > Discord webhook | ||
### Usage | ||
```js | ||
const hook = new(require('circledisc'))('id', 'token', 8080); | ||
``` | ||
``id`` the Webhook's ID | ||
``token`` the Webhook's token | ||
``port`` the port to use |
@@ -17,2 +17,5 @@ const http = require("http"); | ||
/** | ||
* Creates a new CircleCI webhook instance | ||
*/ | ||
class CircleDisc extends EventEmitter { | ||
@@ -25,3 +28,3 @@ | ||
if (port instanceof http.Server) { | ||
this.server = port; | ||
this.server = port || 8080; | ||
} else { | ||
@@ -66,3 +69,7 @@ this.server = http.createServer((req, res) => this._onRequest(req, res)); | ||
} | ||
/** | ||
* gets the result of the payload | ||
* @param {Object} payload | ||
* @returns {Object} the payload to be sent to Discord | ||
*/ | ||
_getResultEmbed (payload) { | ||
@@ -98,2 +105,6 @@ | ||
/** | ||
* Execs a new Payload to Discord | ||
* @param {Object} payload | ||
*/ | ||
_execHook (payload) { | ||
@@ -107,3 +118,3 @@ if (!payload) { | ||
username: "CircleCI", | ||
embeds: [this._getResultEmbed(payload)]; | ||
embeds: [this._getResultEmbed(payload)] | ||
} | ||
@@ -110,0 +121,0 @@ |
7957
159
13