From 64db4b7fd2f2fbe7bf9d5f6a03386eb00cde9045 Mon Sep 17 00:00:00 2001 From: Evan Feenstra Date: Thu, 3 Sep 2020 15:56:59 -0700 Subject: [PATCH] 0.1.3 bot, gen action inside lib --- api/bots/mother.ts | 28 ++-------------------------- dist/api/bots/mother.js | 25 +------------------------ dist/api/bots/mother.js.map | 2 +- package-lock.json | 6 +++--- package.json | 2 +- 5 files changed, 8 insertions(+), 55 deletions(-) diff --git a/api/bots/mother.ts b/api/bots/mother.ts index 74d3e8d..679ad45 100644 --- a/api/bots/mother.ts +++ b/api/bots/mother.ts @@ -1,11 +1,11 @@ import * as Sphinx from 'sphinx-bot' -import {Action, finalAction} from '../controllers/actions' +import {finalAction} from '../controllers/actions' const msg_types = Sphinx.MSG_TYPE export function init() { const client = new Sphinx.Client() - client.login('_', embedToAction) + client.login('_', finalAction) client.on(msg_types.MESSAGE, async (message:Sphinx.Message) => { console.log("INCOMING MSG",message) @@ -21,27 +21,3 @@ export function init() { message.channel.send({ embed }) }) } - -function embedToAction(a){ - let text = '' - let botName = 'Bot' - if(a.embed && a.embed.html) { - text = a.embed.html - botName = a.embed.author - } else if(typeof a==='string') { - text = a - } - finalAction({ - botName, - text, action:'broadcast', - }) -} - -// const helpHTML=`
-// Bot commands: -//
    -//
  • /bot install {BOTNAME}: Install a new bot -//
  • /bot help: Print out this help message -//
-//
-// ` \ No newline at end of file diff --git a/dist/api/bots/mother.js b/dist/api/bots/mother.js index 8f1c3f3..2b50f37 100644 --- a/dist/api/bots/mother.js +++ b/dist/api/bots/mother.js @@ -14,7 +14,7 @@ const actions_1 = require("../controllers/actions"); const msg_types = Sphinx.MSG_TYPE; function init() { const client = new Sphinx.Client(); - client.login('_', embedToAction); + client.login('_', actions_1.finalAction); client.on(msg_types.MESSAGE, (message) => __awaiter(this, void 0, void 0, function* () { console.log("INCOMING MSG", message); const embed = new Sphinx.MessageEmbed() @@ -28,27 +28,4 @@ function init() { })); } exports.init = init; -function embedToAction(a) { - let text = ''; - let botName = 'Bot'; - if (a.embed && a.embed.html) { - text = a.embed.html; - botName = a.embed.author; - } - else if (typeof a === 'string') { - text = a; - } - actions_1.finalAction({ - botName, - text, action: 'broadcast', - }); -} -// const helpHTML=`
-// Bot commands: -//
    -//
  • /bot install {BOTNAME}: Install a new bot -//
  • /bot help: Print out this help message -//
-//
-// ` //# sourceMappingURL=mother.js.map \ No newline at end of file diff --git a/dist/api/bots/mother.js.map b/dist/api/bots/mother.js.map index bbd5ec3..6592e13 100644 --- a/dist/api/bots/mother.js.map +++ b/dist/api/bots/mother.js.map @@ -1 +1 @@ -{"version":3,"file":"mother.js","sourceRoot":"","sources":["../../../api/bots/mother.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qCAAoC;AACpC,oDAA0D;AAC1D,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAA;AAEjC,SAAgB,IAAI;IAElB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAA;IAClC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,aAAa,CAAC,CAAA;IAEhC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,CAAO,OAAsB,EAAE,EAAE;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAC,OAAO,CAAC,CAAA;QAEnC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,YAAY,EAAE;aACpC,SAAS,CAAC,WAAW,CAAC;aACtB,QAAQ,CAAC,eAAe,CAAC;aACzB,SAAS,CAAC;YACT,EAAC,IAAI,EAAC,mBAAmB,EAAC,KAAK,EAAC,wBAAwB,EAAC;YACzD,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,WAAW,EAAC;SAChC,CAAC,CAAA;QAEJ,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;IACjC,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC;AAlBD,oBAkBC;AAED,SAAS,aAAa,CAAC,CAAC;IACtB,IAAI,IAAI,GAAG,EAAE,CAAA;IACb,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE;QAC1B,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAA;QACnB,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAA;KACzB;SAAM,IAAG,OAAO,CAAC,KAAG,QAAQ,EAAE;QAC7B,IAAI,GAAG,CAAC,CAAA;KACT;IACD,qBAAW,CAAS;QAClB,OAAO;QACP,IAAI,EAAE,MAAM,EAAC,WAAW;KACzB,CAAC,CAAA;AACJ,CAAC;AAED,wBAAwB;AACxB,yBAAyB;AACzB,SAAS;AACT,gEAAgE;AAChE,6DAA6D;AAC7D,UAAU;AACV,gBAAgB;AAChB,IAAI"} \ No newline at end of file +{"version":3,"file":"mother.js","sourceRoot":"","sources":["../../../api/bots/mother.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qCAAoC;AACpC,oDAAkD;AAClD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAA;AAEjC,SAAgB,IAAI;IAElB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAA;IAClC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,qBAAW,CAAC,CAAA;IAE9B,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,CAAO,OAAsB,EAAE,EAAE;QAC5D,OAAO,CAAC,GAAG,CAAC,cAAc,EAAC,OAAO,CAAC,CAAA;QAEnC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,YAAY,EAAE;aACpC,SAAS,CAAC,WAAW,CAAC;aACtB,QAAQ,CAAC,eAAe,CAAC;aACzB,SAAS,CAAC;YACT,EAAC,IAAI,EAAC,mBAAmB,EAAC,KAAK,EAAC,wBAAwB,EAAC;YACzD,EAAC,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,WAAW,EAAC;SAChC,CAAC,CAAA;QAEJ,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;IACjC,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC;AAlBD,oBAkBC"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b4396d3..8047d38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10876,9 +10876,9 @@ } }, "sphinx-bot": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/sphinx-bot/-/sphinx-bot-0.1.2.tgz", - "integrity": "sha512-sIPk3Up2I4tI+nE6RfMKlh0mWVUpEbQXUYBts1TW8z6OhF27o+guMvp1KKJKd0dqZDIxO/ucB9zLKAY54RDYog==", + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/sphinx-bot/-/sphinx-bot-0.1.3.tgz", + "integrity": "sha512-MF0+WKVkfNn3yRoL5DcH22td8v3Tu6G1RBdYwcCzaOGDFfjUs+tSmvfY3x4kqU3tZ8wJwzeUVSiwh+hGWZ7W0w==", "requires": { "eventemitter3": "^4.0.7" }, diff --git a/package.json b/package.json index 7d547a8..2322e92 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "short-uuid": "^3.1.1", "sjcl": "^1.0.8", "socket.io": "^2.3.0", - "sphinx-bot": "^0.1.2", + "sphinx-bot": "^0.1.3", "tail": "^2.0.3", "ts-node": "^8.5.4", "tsc": "^1.20150623.0",