Browse Source

convert lumo->discord msg type, try welcome bot, chat_bot table for local bots

push-params
Evan Feenstra 4 years ago
parent
commit
3dc9b091b9
  1. 16
      api/bots/index.ts
  2. 8
      api/bots/mother.ts
  3. 55
      api/bots/welcome.ts
  4. 13
      api/controllers/bots.ts
  5. 4
      api/models/ts/bot.ts
  6. 4
      api/models/ts/botMember.ts
  7. 35
      api/models/ts/chatBot.ts
  8. 12
      api/models/ts/chatMember.ts
  9. 18
      api/network/intercept.ts
  10. 22
      api/utils/setup.ts
  11. 5
      config/constants.json
  12. 16
      dist/api/bots/index.js
  13. 2
      dist/api/bots/index.js.map
  14. 10
      dist/api/bots/mother.js
  15. 2
      dist/api/bots/mother.js.map
  16. 64
      dist/api/bots/welcome.js
  17. 2
      dist/api/bots/welcome.js.map
  18. 14
      dist/api/controllers/bots.js
  19. 2
      dist/api/controllers/bots.js.map
  20. 3
      dist/api/models/ts/bot.js
  21. 2
      dist/api/models/ts/bot.js.map
  22. 3
      dist/api/models/ts/botMember.js
  23. 2
      dist/api/models/ts/botMember.js.map
  24. 56
      dist/api/models/ts/chatBot.js
  25. 1
      dist/api/models/ts/chatBot.js.map
  26. 16
      dist/api/models/ts/chatMember.js
  27. 2
      dist/api/models/ts/chatMember.js.map
  28. 17
      dist/api/network/intercept.js
  29. 2
      dist/api/network/intercept.js.map
  30. 22
      dist/api/utils/setup.js
  31. 2
      dist/api/utils/setup.js.map
  32. 5
      dist/config/constants.json
  33. 26
      package-lock.json
  34. 2
      package.json

16
api/bots/index.ts

@ -1,13 +1,19 @@
// import * as Sphinx from '../../../sphinx-bot'
import * as Sphinx from 'sphinx-bot'
// import * as SphinxBot from '../../../sphinx-bot'
import * as SphinxBot from 'sphinx-bot'
import * as MotherBot from './mother'
import {Msg} from '../network/interfaces'
function init(){
MotherBot.init()
}
function emit(content, chatUUID){
Sphinx._emit('message',{content,chatUUID})
function builtinBotEmit(msg:Msg){
SphinxBot._emit('message', <SphinxBot.Message>{
channel:{
id: msg.chat.uuid,
},
content: msg.message.content
})
}
export {init,emit,MotherBot}
export {init,builtinBotEmit}

8
api/bots/mother.ts

@ -1,4 +1,4 @@
// import * as Sphinx from '../../../sphinx-bot'
// import * as SphinxBot from '../../../sphinx-bot'
import * as Sphinx from 'sphinx-bot'
import { finalAction } from '../controllers/actions'
const msg_types = Sphinx.MSG_TYPE
@ -11,6 +11,7 @@ export function init() {
client.on(msg_types.MESSAGE, async (message: Sphinx.Message) => {
const arr = message.content.split(' ')
if (arr.length < 2) return
if (arr[0]!=='/bot') return
const cmd = arr[1]
switch (cmd) {
@ -28,7 +29,12 @@ export function init() {
{ name: 'Install a new bot', value: '/bot install {BOTNAME}' },
{ name: 'Help', value: '/bot help' }
])
.setThumbnail(botSVG)
message.channel.send({ embed })
}
})
}
const botSVG = `<svg viewBox="64 64 896 896" height="12" width="12" color="white">
<path d="M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" />
</svg>`

55
api/bots/welcome.ts

@ -0,0 +1,55 @@
import * as Sphinx from 'sphinx-bot'
import { finalAction } from '../controllers/actions'
import { models } from '../models'
import * as path from 'path'
const msg_types = Sphinx.MSG_TYPE
const constants = require(path.join(__dirname, '../../config/constants.json'))
export function init() {
const client = new Sphinx.Client()
client.login('_', finalAction)
client.on(msg_types.MESSAGE, async (message: Sphinx.Message) => {
const arr = message.content.split(' ')
if (arr.length < 2) return
if (arr[0]!=='/welcome') return
const cmd = arr[1]
switch (cmd) {
case 'setmessage':
if (arr.length < 3) return
console.log("setmsg", arr[2])
const chat = await models.Chat.findOne({where:{uuid:message.channel.id}})
if(!chat) return
const chatBot = await models.ChatBot.findOne({where:{
chatID: chat.id, botPrefix:'/welcome', botType:constants.bot_types.builtin
}})
if(!chatBot) return
await chatBot.update({meta:arr[2]})
const resEmbed = new Sphinx.MessageEmbed()
.setAuthor('WelcomeBot')
.setDescription('Your welcome message has been updated')
message.channel.send({ embed:resEmbed })
return
default:
const embed = new Sphinx.MessageEmbed()
.setAuthor('WelcomeBot')
.setTitle('Bot Commands:')
.addFields([
{ name: 'Set welcome message', value: '/welcome setmessage {MESSAGE}' },
{ name: 'Help', value: '/welcome help' }
])
.setThumbnail(botSVG)
message.channel.send({ embed })
return
}
})
}
const botSVG = `<svg viewBox="64 64 896 896" height="12" width="12" color="white">
<path d="M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" />
</svg>`

13
api/controllers/bots.ts

@ -1,25 +1,12 @@
import * as path from 'path'
import {Msg} from '../network/interfaces'
import * as tribes from '../utils/tribes'
import * as crypto from 'crypto'
import { models } from '../models'
import * as jsonUtils from '../utils/json'
import { success, failure } from '../utils/res'
import {emit as emitBotMsg} from '../bots'
const constants = require(path.join(__dirname, '../../config/constants.json'))
// return bool whether this is legit to process
export async function processBotMessage(msg:Msg, chat, botInTribe): Promise<boolean> {
const txt = msg.message.content
if(txt.startsWith('/bot ')){
emitBotMsg(txt, chat.uuid)
} else {
}
return true
}
export const getBots = async (req, res) => {
try {
const bots = await models.Bot.findAll()

4
api/models/ts/bot.ts

@ -1,5 +1,9 @@
import { Table, Column, Model, DataType } from 'sequelize-typescript';
/*
BOT CREATOR - this handles the webhook and external API
*/
@Table({tableName: 'sphinx_bots', underscored: true})
export default class Bot extends Model<Bot> {

4
api/models/ts/botMember.ts

@ -1,5 +1,9 @@
import { Table, Column, Model } from 'sequelize-typescript';
/*
BOT CREATOR - store the installers of your bot
*/
@Table({tableName: 'sphinx_bot_members', underscored: true})
export default class BotMember extends Model<BotMember> {

35
api/models/ts/chatBot.ts

@ -0,0 +1,35 @@
import { Table, Column, Model } from 'sequelize-typescript';
/*
TRIBE OWNER - bots installed as "contacts" in a tribe
*/
@Table({tableName: 'sphinx_chat_members', underscored: true, indexes:[
{unique:true, fields:['chat_id','bot_uuid']}
]})
export default class ChatBot extends Model<ChatBot> {
@Column
chatId: number
@Column
botUuid: string
@Column
botType: number
@Column
botPrefix: string
@Column
botMakerPubkey: string
@Column
meta: string // for saved preferences for local bots
@Column
createdAt: Date
@Column
updatedAt: Date
}

12
api/models/ts/chatMember.ts

@ -26,16 +26,4 @@ export default class ChatMember extends Model<ChatMember> {
@Column
status: number
@Column
bot: boolean
@Column
botPrefix: string
@Column
botMakerPubkey: string
@Column
botUuid: string
}

18
api/network/intercept.ts

@ -1,6 +1,6 @@
import {processBotMessage} from '../controllers/bots'
import {Msg} from './interfaces'
import { models } from '../models'
import {builtinBotEmit} from '../bots'
// const defaultPrefixes = [
// '/bot', '/welcome'
@ -14,24 +14,26 @@ export async function isBotMsg(msg:Msg, sentByMe:boolean): Promise<boolean> {
}})
if(!chat) return false
let didEmit = false
if(txt.startsWith('/bot ')) {
const ok = processBotMessage(msg, chat, null)
return ok?true:false
builtinBotEmit(msg)
didEmit = true
}
const botsInTribe = await models.ChatMember.findAll({where:{
bot:true, chatId: chat.id
const botsInTribe = await models.ChatBot.findAll({where:{
chatId: chat.id
}})
if(!(botsInTribe && botsInTribe.length)) return false
let ok = false
await asyncForEach(botsInTribe, async botInTribe=>{
if(txt.startsWith(`${botInTribe.botPrefix} `)){
ok = await processBotMessage(msg, chat, botInTribe)
builtinBotEmit(msg)
didEmit = true
}
})
return ok
return didEmit
}
async function asyncForEach(array, callback) {

22
api/utils/setup.ts

@ -31,10 +31,24 @@ async function setVersion(){
}
async function migrate(){
addTableColumn('sphinx_chat_members', 'bot', 'BOOLEAN')
addTableColumn('sphinx_chat_members', 'bot_prefix')
addTableColumn('sphinx_chat_members', 'bot_maker_pubkey')
addTableColumn('sphinx_chat_members', 'bot_uuid')
try{
await sequelize.query(`
CREATE TABLE sphinx_chat_bots (
chat_id BIGINT,
bot_uuid TEXT,
bot_type INT,
bot_prefix TEXT,
bot_maker_pubkey TEXT,
meta TEXT,
created_at DATETIME,
updated_at DATETIME
)`)
} catch(e){}
try{
await sequelize.query(`CREATE UNIQUE INDEX chat_bot_index ON sphinx_chat_bots(chat_id, bot_uuid);`)
}catch(e){}
addTableColumn('sphinx_bots', 'webhook')
addTableColumn('sphinx_bots', 'uuid')

5
config/constants.json

@ -65,6 +65,11 @@
"group": 1,
"tribe": 2
},
"bot_types": {
"builtin": 0,
"local": 1,
"remote": 2
},
"chat_roles": {
"-": 0,
"owner": 1,

16
dist/api/bots/index.js

@ -1,15 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// import * as Sphinx from '../../../sphinx-bot'
const Sphinx = require("sphinx-bot");
// import * as SphinxBot from '../../../sphinx-bot'
const SphinxBot = require("sphinx-bot");
const MotherBot = require("./mother");
exports.MotherBot = MotherBot;
function init() {
MotherBot.init();
}
exports.init = init;
function emit(content, chatUUID) {
Sphinx._emit('message', { content, chatUUID });
function builtinBotEmit(msg) {
SphinxBot._emit('message', {
channel: {
id: msg.chat.uuid,
},
content: msg.message.content
});
}
exports.emit = emit;
exports.builtinBotEmit = builtinBotEmit;
//# sourceMappingURL=index.js.map

2
dist/api/bots/index.js.map

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/bots/index.ts"],"names":[],"mappings":";;AAAA,gDAAgD;AAChD,qCAAoC;AACpC,sCAAqC;AAUnB,8BAAS;AAR3B,SAAS,IAAI;IACT,SAAS,CAAC,IAAI,EAAE,CAAA;AACpB,CAAC;AAMO,oBAAI;AAJZ,SAAS,IAAI,CAAC,OAAO,EAAE,QAAQ;IAC3B,MAAM,CAAC,KAAK,CAAC,SAAS,EAAC,EAAC,OAAO,EAAC,QAAQ,EAAC,CAAC,CAAA;AAC9C,CAAC;AAEY,oBAAI"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../api/bots/index.ts"],"names":[],"mappings":";;AAAA,mDAAmD;AACnD,wCAAuC;AACvC,sCAAqC;AAGrC,SAAS,IAAI;IACT,SAAS,CAAC,IAAI,EAAE,CAAA;AACpB,CAAC;AAWO,oBAAI;AATZ,SAAS,cAAc,CAAC,GAAO;IAC3B,SAAS,CAAC,KAAK,CAAC,SAAS,EAAqB;QAC1C,OAAO,EAAC;YACJ,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI;SACpB;QACD,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO;KAC/B,CAAC,CAAA;AACN,CAAC;AAEY,wCAAc"}

10
dist/api/bots/mother.js

@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
// import * as Sphinx from '../../../sphinx-bot'
// import * as SphinxBot from '../../../sphinx-bot'
const Sphinx = require("sphinx-bot");
const actions_1 = require("../controllers/actions");
const msg_types = Sphinx.MSG_TYPE;
@ -20,6 +20,8 @@ function init() {
const arr = message.content.split(' ');
if (arr.length < 2)
return;
if (arr[0] !== '/bot')
return;
const cmd = arr[1];
switch (cmd) {
case 'install':
@ -35,10 +37,14 @@ function init() {
.addFields([
{ name: 'Install a new bot', value: '/bot install {BOTNAME}' },
{ name: 'Help', value: '/bot help' }
]);
])
.setThumbnail(botSVG);
message.channel.send({ embed });
}
}));
}
exports.init = init;
const botSVG = `<svg viewBox="64 64 896 896" height="12" width="12" color="white">
<path d="M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" />
</svg>`;
//# sourceMappingURL=mother.js.map

2
dist/api/bots/mother.js.map

@ -1 +1 @@
{"version":3,"file":"mother.js","sourceRoot":"","sources":["../../../api/bots/mother.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iDAAiD;AACjD,qCAAoC;AACpC,oDAAoD;AACpD,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,OAAuB,EAAE,EAAE;QAC7D,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACtC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;YAAE,OAAM;QAC1B,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAA;QAClB,QAAQ,GAAG,EAAE;YAEX,KAAK,SAAS;gBACZ,IAAI,G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AA;QAClB,QAAQ,GAAG,EAAE;YAEX,KAAK,SAAS;gBACZ,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;oBAAE,OAAM;gBAC1B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;gBAC9B,iCAAiC;gBACjC,OAAO,IAAI,CAAA;YAEb;gBACE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,YAAY,EAAE;qBACpC,SAAS,CAAC,WAAW,CAAC;qBACtB,QAAQ,CAAC,eAAe,CAAC;qBACzB,SAAS,CAAC;oBACT,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,wBAAwB,EAAE;oBAC9D,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE;iBACrC,CAAC;qBACD,YAAY,CAAC,MAAM,CAAC,CAAA;gBACvB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;SAClC;IACH,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC;AA9BD,oBA8BC;AAED,MAAM,MAAM,GAAG;;OAER,CAAA"}

64
dist/api/bots/welcome.js

@ -1 +1,65 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const Sphinx = require("sphinx-bot");
const actions_1 = require("../controllers/actions");
const models_1 = require("../models");
const path = require("path");
const msg_types = Sphinx.MSG_TYPE;
const constants = require(path.join(__dirname, '../../config/constants.json'));
function init() {
const client = new Sphinx.Client();
client.login('_', actions_1.finalAction);
client.on(msg_types.MESSAGE, (message) => __awaiter(this, void 0, void 0, function* () {
const arr = message.content.split(' ');
if (arr.length < 2)
return;
if (arr[0] !== '/welcome')
return;
const cmd = arr[1];
switch (cmd) {
case 'setmessage':
if (arr.length < 3)
return;
console.log("setmsg", arr[2]);
const chat = yield models_1.models.Chat.findOne({ where: { uuid: message.channel.id } });
if (!chat)
return;
const chatBot = yield models_1.models.ChatBot.findOne({ where: {
chatID: chat.id, botPrefix: '/welcome', botType: constants.bot_types.builtin
} });
if (!chatBot)
return;
yield chatBot.update({ meta: arr[2] });
const resEmbed = new Sphinx.MessageEmbed()
.setAuthor('WelcomeBot')
.setDescription('Your welcome message has been updated');
message.channel.send({ embed: resEmbed });
return;
default:
const embed = new Sphinx.MessageEmbed()
.setAuthor('WelcomeBot')
.setTitle('Bot Commands:')
.addFields([
{ name: 'Set welcome message', value: '/welcome setmessage {MESSAGE}' },
{ name: 'Help', value: '/welcome help' }
])
.setThumbnail(botSVG);
message.channel.send({ embed });
return;
}
}));
}
exports.init = init;
const botSVG = `<svg viewBox="64 64 896 896" height="12" width="12" color="white">
<path d="M300 328a60 60 0 10120 0 60 60 0 10-120 0zM852 64H172c-17.7 0-32 14.3-32 32v660c0 17.7 14.3 32 32 32h680c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-32 660H204V128h616v596zM604 328a60 60 0 10120 0 60 60 0 10-120 0zm250.2 556H169.8c-16.5 0-29.8 14.3-29.8 32v36c0 4.4 3.3 8 7.4 8h729.1c4.1 0 7.4-3.6 7.4-8v-36c.1-17.7-13.2-32-29.7-32zM664 508H360c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" />
</svg>`;
//# sourceMappingURL=welcome.js.map

2
dist/api/bots/welcome.js.map

@ -1 +1 @@
{"version":3,"file":"welcome.js","sourceRoot":"","sources":["../../../api/bots/welcome.ts"],"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EAAC;wBAClD,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAC,UAAU,EAAE,OAAO,EAAC,SAAS,CAAC,SAAS,CAAC,OAAO;qBAC3E,EAAC,CAAC,CAAA;gBACH,IAAG,CAAC,OAAO;oBAAE,OAAM;gBACnB,MAAM,OAAO,CAAC,MAAM,CAAC,EAAC,IAAI,EAAC,GAAG,CAAC,CAAC,CAAC,EAAC,CAAC,CAAA;gBACnC,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,YAAY,EAAE;qBACvC,SAAS,CAAC,YAAY,CAAC;qBACvB,cAAc,CAAC,uCAAuC,CAAC,CAAA;gBAC1D,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAC,QAAQ,EAAE,CAAC,CAAA;gBACxC,OAAM;YAER;gBACE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,YAAY,EAAE;qBACpC,SAAS,CAAC,YAAY,CAAC;qBACvB,QAAQ,CAAC,eAAe,CAAC;qBACzB,SAAS,CAAC;oBACT,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,+BAA+B,EAAE;oBACvE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE;iBACzC,CAAC;qBACD,YAAY,CAAC,MAAM,CAAC,CAAA;gBACvB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;gBAC/B,OAAM;SACT;IACH,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC;AA1CD,oBA0CC;AAED,MAAM,MAAM,GAAG;;OAER,CAAA"}

14
dist/api/controllers/bots.js

@ -15,21 +15,7 @@ const crypto = require("crypto");
const models_1 = require("../models");
const jsonUtils = require("../utils/json");
const res_1 = require("../utils/res");
const bots_1 = require("../bots");
const constants = require(path.join(__dirname, '../../config/constants.json'));
// return bool whether this is legit to process
function processBotMessage(msg, chat, botInTribe) {
return __awaiter(this, void 0, void 0, function* () {
const txt = msg.message.content;
if (txt.startsWith('/bot ')) {
bots_1.emit(txt, chat.uuid);
}
else {
}
return true;
});
}
exports.processBotMessage = processBotMessage;
exports.getBots = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
try {
const bots = yield models_1.models.Bot.findAll();

2
dist/api/controllers/bots.js.map

@ -1 +1 @@
{"version":3,"file":"bots.js","sourceRoot":"","sources":["../../../api/controllers/bots.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA4B;AAE5B,0CAAyC;AACzC,iCAAgC;AAChC,sCAAkC;AAClC,2CAA0C;AAC1C,sCAA+C;AAC/C,kCAA0C;AAE1C,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC,CAAA;AAE9E,+CAA+C;AAC/C,SAAsB,iBAAiB,CAAC,GAAO,EAAE,IAAI,EAAE,UAAU;;QAC/D,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAA;QAC/B,IAAG,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAC;YACzB,WAAU,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;SAC3B;aAAM;SAEN;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CAAA;AARD,8CAQC;AAEY,QAAA,OAAO,GAAG,CAAO,GAAG,EAAE,GAAG,EAAE,EAAE;IACxC,IAAI;QACA,MAAM,IAAI,GAAG,MAAM,eAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAA;QACvC,aAAO,CAAC,GAAG,EAAE;YACT,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;SAC7C,CAAC,CAAA;KACL;IAAC,OAAM,CAAC,EAAE;QACP,aAAO,CAAC,GAAG,EAAC,SAAS,CAAC,CAAA;KACzB;AACH,CAAC,CAAA,CAAA;AAEY,QAAA,SAA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EAAE,EAAE,EAAE,CAAC,CAAA;QACrC,aAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;KACrB;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAA;QACjC,aAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;KAClB;AACH,CAAC,CAAA,CAAA;AAED,6CAA6C;AAC7C,0BAA0B;AAC1B,0BAA0B;AAC1B,iCAAiC;AACjC,0BAA0B;AAC1B,OAAO;AACP,IAAI;AAEJ,SAAgB,UAAU,CAAC,OAAO,EAAC,UAAU;IAC3C,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;IAC9B,oCAAoC;IAEpC,iCAAiC;IACjC,gCAAgC;IAEhC,oCAAoC;IACpC,yCAAyC;AAC3C,CAAC;AATD,gCASC;AAED,SAAsB,iBAAiB,CAAC,OAAO;;QAC7C,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;QACnC,yCAAyC;QACzC,4CAA4C;QAC5C,mCAAmC;QAEnC,mDAAmD;QAEnD,0CAA0C;IAC5C,CAAC;CAAA;AATD,8CASC;AAED,oEAAoE;AAEpE,SAAsB,aAAa,CAAC,OAAO;;QACzC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC9C,CAAC;CAAA;AAFD,sCAEC;AAED,SAAsB,aAAa,CAAC,OAAO;;QACzC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC9C,CAAC;CAAA;AAFD,sCAEC"}

3
dist/api/models/ts/bot.js

@ -10,6 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const sequelize_typescript_1 = require("sequelize-typescript");
/*
BOT CREATOR - this handles the webhook and external API
*/
let Bot = class Bot extends sequelize_typescript_1.Model {
};
__decorate([

2
dist/api/models/ts/bot.js.map

@ -1 +1 @@
{"version":3,"file":"bot.js","sourceRoot":"","sources":["../../../../api/models/ts/bot.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAsE;AAGtE,IAAqB,GAAG,GAAxB,MAAqB,GAAI,SAAQ,4BAAU;CA2B1C,CAAA;AApBC;IALC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,IAAI;QACnB,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;KACb,CAAC;;+BACQ;AAGV;IADC,6BAAM;;iCACK;AAGZ;IADC,6BAAM;;iCACK;AAGZ;IADC,6BAAM;;mCACO;AAGd;IADC,6BAAM;;oCACQ;AAGf;IADC,6BAAM;8BACI,IAAI;sCAAA;AAGf;IADC,6BAAM;8BACI,IAAI;sCAAA;AAzBI,GAAG;IADvB,4BAAK,CAAC,EAAC,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GAChC,GAAG,CA2BvB;kBA3BoB,GAAG"}
{"version":3,"file":"bot.js","sourceRoot":"","sources":["../../../../api/models/ts/bot.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAsE;AAEtE;;EAEE;AAGF,IAAqB,GAAG,GAAxB,MAAqB,GAAI,SAAQ,4BAAU;CA2B1C,CAAA;AApBC;IALC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,IAAI;QACnB,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;KACb,CAAC;;+BACQ;AAGV;IADC,6BAAM;;iCACK;AAGZ;IADC,6BAAM;;iCACK;AAGZ;IADC,6BAAM;;mCACO;AAGd;IADC,6BAAM;;oCACQ;AAGf;IADC,6BAAM;8BACI,IAAI;sCAAA;AAGf;IADC,6BAAM;8BACI,IAAI;sCAAA;AAzBI,GAAG;IADvB,4BAAK,CAAC,EAAC,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GAChC,GAAG,CA2BvB;kBA3BoB,GAAG"}

3
dist/api/models/ts/botMember.js

@ -10,6 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const sequelize_typescript_1 = require("sequelize-typescript");
/*
BOT CREATOR - store the installers of your bot
*/
let BotMember = class BotMember extends sequelize_typescript_1.Model {
};
__decorate([

2
dist/api/models/ts/botMember.js.map

@ -1 +1 @@
{"version":3,"file":"botMember.js","sourceRoot":"","sources":["../../../../api/models/ts/botMember.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA4D;AAG5D,IAAqB,SAAS,GAA9B,MAAqB,SAAU,SAAQ,4BAAgB;CAiBtD,CAAA;AAdC;IADC,6BAAM;;+CACa;AAGpB;IADC,6BAAM;;4CACU;AAGjB;IADC,6BAAM;;2CACS;AAGhB;IADC,6BAAM;8BACI,IAAI;4CAAA;AAGf;IADC,6BAAM;8BACI,IAAI;4CAAA;AAfI,SAAS;IAD7B,4BAAK,CAAC,EAAC,SAAS,EAAE,oBAAoB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACvC,SAAS,CAiB7B;kBAjBoB,SAAS"}
{"version":3,"file":"botMember.js","sourceRoot":"","sources":["../../../../api/models/ts/botMember.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA4D;AAE5D;;EAEE;AAGF,IAAqB,SAAS,GAA9B,MAAqB,SAAU,SAAQ,4BAAgB;CAiBtD,CAAA;AAdC;IADC,6BAAM;;+CACa;AAGpB;IADC,6BAAM;;4CACU;AAGjB;IADC,6BAAM;;2CACS;AAGhB;IADC,6BAAM;8BACI,IAAI;4CAAA;AAGf;IADC,6BAAM;8BACI,IAAI;4CAAA;AAfI,SAAS;IAD7B,4BAAK,CAAC,EAAC,SAAS,EAAE,oBAAoB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACvC,SAAS,CAiB7B;kBAjBoB,SAAS"}

56
dist/api/models/ts/chatBot.js

@ -0,0 +1,56 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const sequelize_typescript_1 = require("sequelize-typescript");
/*
TRIBE OWNER - bots installed as "contacts" in a tribe
*/
let ChatBot = class ChatBot extends sequelize_typescript_1.Model {
};
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Number)
], ChatBot.prototype, "chatId", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], ChatBot.prototype, "botUuid", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Number)
], ChatBot.prototype, "botType", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], ChatBot.prototype, "botPrefix", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], ChatBot.prototype, "botMakerPubkey", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], ChatBot.prototype, "meta", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Date)
], ChatBot.prototype, "createdAt", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Date)
], ChatBot.prototype, "updatedAt", void 0);
ChatBot = __decorate([
sequelize_typescript_1.Table({ tableName: 'sphinx_chat_members', underscored: true, indexes: [
{ unique: true, fields: ['chat_id', 'bot_uuid'] }
] })
], ChatBot);
exports.default = ChatBot;
//# sourceMappingURL=chatBot.js.map

1
dist/api/models/ts/chatBot.js.map

@ -0,0 +1 @@
{"version":3,"file":"chatBot.js","sourceRoot":"","sources":["../../../../api/models/ts/chatBot.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA4D;AAE5D;;EAEE;AAKF,IAAqB,OAAO,GAA5B,MAAqB,OAAQ,SAAQ,4BAAc;CAyBlD,CAAA;AAtBC;IADC,6BAAM;;uCACO;AAGd;IADC,6BAAM;;wCACQ;AAGf;IADC,6BAAM;;wCACQ;AAGf;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM;;+CACe;AAGtB;IADC,6BAAM;;qCACK;AAGZ;IADC,6BAAM;8BACI,IAAI;0CAAA;AAGf;IADC,6BAAM;8BACI,IAAI;0CAAA;AAxBI,OAAO;IAH3B,4BAAK,CAAC,EAAC,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAC;YACnE,EAAC,MAAM,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,SAAS,EAAC,UAAU,CAAC,EAAC;SAC7C,EAAC,CAAC;GACkB,OAAO,CAyB3B;kBAzBoB,OAAO"}

16
dist/api/models/ts/chatMember.js

@ -40,22 +40,6 @@ __decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Number)
], ChatMember.prototype, "status", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Boolean)
], ChatMember.prototype, "bot", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], ChatMember.prototype, "botPrefix", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], ChatMember.prototype, "botMakerPubkey", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], ChatMember.prototype, "botUuid", void 0);
ChatMember = __decorate([
sequelize_typescript_1.Table({ tableName: 'sphinx_chat_members', underscored: true, indexes: [
{ unique: true, fields: ['chat_id', 'contact_id'] }

2
dist/api/models/ts/chatMember.js.map

@ -1 +1 @@
{"version":3,"file":"chatMember.js","sourceRoot":"","sources":["../../../../api/models/ts/chatMember.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA4D;AAK5D,IAAqB,UAAU,GAA/B,MAAqB,UAAW,SAAQ,4BAAiB;CAmCxD,CAAA;AAhCC;IADC,6BAAM;;0CACO;AAGd;IADC,6BAAM;;6CACU;AAGjB;IADC,6BAAM;;wCACK;AAGZ;IADC,6BAAM;;8CACW;AAGlB;IADC,6BAAM;;iDACc;AAGrB;IADC,6BAAM;8BACK,IAAI;8CAAA;AAGhB;IADC,6BAAM;;0CACO;AAGd;IADC,6BAAM;;uCACK;AAGZ;IADC,6BAAM;;6CACU;AAGjB;IADC,6BAAM;;kDACe;AAGtB;IADC,6BAAM;;2CACQ;AAjCI,UAAU;IAH9B,4BAAK,CAAC,EAAC,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAC;YACnE,EAAC,MAAM,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,SAAS,EAAC,YAAY,CAAC,EAAC;SAC/C,EAAC,CAAC;GACkB,UAAU,CAmC9B;kBAnCoB,UAAU"}
{"version":3,"file":"chatMember.js","sourceRoot":"","sources":["../../../../api/models/ts/chatMember.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA4D;AAK5D,IAAqB,UAAU,GAA/B,MAAqB,UAAW,SAAQ,4BAAiB;CAuBxD,CAAA;AApBC;IADC,6BAAM;;0CACO;AAGd;IADC,6BAAM;;6CACU;AAGjB;IADC,6BAAM;;wCACK;AAGZ;IADC,6BAAM;;8CACW;AAGlB;IADC,6BAAM;;iDACc;AAGrB;IADC,6BAAM;8BACK,IAAI;8CAAA;AAGhB;IADC,6BAAM;;0CACO;AArBK,UAAU;IAH9B,4BAAK,CAAC,EAAC,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAC;YACnE,EAAC,MAAM,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,SAAS,EAAC,YAAY,CAAC,EAAC;SAC/C,EAAC,CAAC;GACkB,UAAU,CAuB9B;kBAvBoB,UAAU"}

17
dist/api/network/intercept.js

@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const bots_1 = require("../controllers/bots");
const models_1 = require("../models");
const bots_1 = require("../bots");
// const defaultPrefixes = [
// '/bot', '/welcome'
// ]
@ -23,22 +23,23 @@ function isBotMsg(msg, sentByMe) {
} });
if (!chat)
return false;
let didEmit = false;
if (txt.startsWith('/bot ')) {
const ok = bots_1.processBotMessage(msg, chat, null);
return ok ? true : false;
bots_1.builtinBotEmit(msg);
didEmit = true;
}
const botsInTribe = yield models_1.models.ChatMember.findAll({ where: {
bot: true, chatId: chat.id
const botsInTribe = yield models_1.models.ChatBot.findAll({ where: {
chatId: chat.id
} });
if (!(botsInTribe && botsInTribe.length))
return false;
let ok = false;
yield asyncForEach(botsInTribe, (botInTribe) => __awaiter(this, void 0, void 0, function* () {
if (txt.startsWith(`${botInTribe.botPrefix} `)) {
ok = yield bots_1.processBotMessage(msg, chat, botInTribe);
bots_1.builtinBotEmit(msg);
didEmit = true;
}
}));
return ok;
return didEmit;
});
}
exports.isBotMsg = isBotMsg;

2
dist/api/network/intercept.js.map

@ -1 +1 @@
{"version":3,"file":"intercept.js","sourceRoot":"","sources":["../../../api/network/intercept.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,8CAAqD;AAErD,sCAAkC;AAElC,4BAA4B;AAC5B,uBAAuB;AACvB,IAAI;AAEJ,kDAAkD;AAClD,SAAsB,QAAQ,CAAC,GAAO,EAAE,QAAgB;;QACtD,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAA;QAC/B,MAAM,IAAI,GAAG,MAAM,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAC,KAAK,EAAC;gBAC5C,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI;aACpB,EAAC,CAAC,CAA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CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC5C;IACF,CAAC;CAAA"}

22
dist/api/utils/setup.js

@ -44,10 +44,24 @@ function setVersion() {
}
function migrate() {
return __awaiter(this, void 0, void 0, function* () {
addTableColumn('sphinx_chat_members', 'bot', 'BOOLEAN');
addTableColumn('sphinx_chat_members', 'bot_prefix');
addTableColumn('sphinx_chat_members', 'bot_maker_pubkey');
addTableColumn('sphinx_chat_members', 'bot_uuid');
try {
yield models_1.sequelize.query(`
CREATE TABLE sphinx_chat_bots (
chat_id BIGINT,
bot_uuid TEXT,
bot_type INT,
bot_prefix TEXT,
bot_maker_pubkey TEXT,
meta TEXT,
created_at DATETIME,
updated_at DATETIME
)`);
}
catch (e) { }
try {
yield models_1.sequelize.query(`CREATE UNIQUE INDEX chat_bot_index ON sphinx_chat_bots(chat_id, bot_uuid);`);
}
catch (e) { }
addTableColumn('sphinx_bots', 'webhook');
addTableColumn('sphinx_bots', 'uuid');
try {

2
dist/api/utils/setup.js.map

@ -1 +1 @@
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../api/utils/setup.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAA2C;AAC3C,sCAA2C;AAC3C,iDAAoC;AACpC,iCAAgC;AAChC,sCAAqC;AACrC,gDAAwC;AACxC,8CAA0D;AAE1D,MAAM,YAAY,GAAG,CAAC,CAAA;AAEtB,MAAM,aAAa,GAAG,GAAS,EAAE;IAC/B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;IACxC,MAAM,UAAU,EAAE,CAAA;IAClB,IAAI;QACF,MAAM,kBAAS,CAAC,IAAI,EAAE,CAAA;QACtB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;KACpC;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAC,CAAC,CAAC,CAAA;KAChC;IACD,MAAM,OAAO,EAAE,CAAA;IACf,iBAA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C,QAAQ,CAAC,GAAG,EAAC,EAAC,IAAI,EAAC,UAAU,EAAC,EAAE,UAAU,GAAG,EAAE,GAAG;YACvD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAClB,CAAC,CAAC,CAAA;IACJ,CAAC;CAAA"}

5
dist/config/constants.json

@ -65,6 +65,11 @@
"group": 1,
"tribe": 2
},
"bot_types": {
"builtin": 0,
"local": 1,
"remote": 2
},
"chat_roles": {
"-": 0,
"owner": 1,

26
package-lock.json

@ -1057,6 +1057,14 @@
"@types/node": "*"
}
},
"@types/dompurify": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-2.0.4.tgz",
"integrity": "sha512-y6K7NyXTQvjr8hJNsAFAD8yshCsIJ0d+OYEFzULuIqWyWOKL2hRru1I+rorI5U0K4SLAROTNuSUFXPDTu278YA==",
"requires": {
"@types/trusted-types": "*"
}
},
"@types/download": {
"version": "6.2.4",
"resolved": "https://registry.npmjs.org/@types/download/-/download-6.2.4.tgz",
@ -1173,6 +1181,11 @@
"resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.0.34.tgz",
"integrity": "sha512-Tx7JYeYR+pkAnDQjN1Cj43KuOuUvyybZHl+fAezReXuH/SQoxLhsuPvHZH/SA4XtrBEhaTcbb5gVc1WQcjQgdg=="
},
"@types/trusted-types": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-1.0.6.tgz",
"integrity": "sha512-230RC8sFeHoT6sSUlRO6a8cAnclO06eeiq1QDfiv2FGCLWFvvERWgwIQD4FWqD9A69BN7Lzee4OXwoMVnnsWDw=="
},
"@types/uuid": {
"version": "3.4.4",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.4.tgz",
@ -3715,6 +3728,11 @@
"integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==",
"dev": true
},
"dompurify": {
"version": "2.0.15",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.0.15.tgz",
"integrity": "sha512-8AnYW8iXOC7xC7K3FBvQ7+GdmtOsgDGZC5dDXaewCC674qcId7G5mhz5VIEnVShJVjQdlcaPjxpaOzaV9JC3Tg=="
},
"dont-sniff-mimetype": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/dont-sniff-mimetype/-/dont-sniff-mimetype-1.1.0.tgz",
@ -10876,10 +10894,12 @@
}
},
"sphinx-bot": {
"version": "0.1.9",
"resolved": "https://registry.npmjs.org/sphinx-bot/-/sphinx-bot-0.1.9.tgz",
"integrity": "sha512-Ri0D6QBw6cdYu8XUXIFqLwSBMANOtQB593/FV2Jz7DV4gTEMw7IqRhGmryqaYNxo08Nq8muwhh79bsTxHvANBw==",
"version": "0.1.12",
"resolved": "https://registry.npmjs.org/sphinx-bot/-/sphinx-bot-0.1.12.tgz",
"integrity": "sha512-qZMJTaJD00GD5a1OIbRkWbaEkb7evYrQt1Q9Fk9VgTfWV8Qe+9xv6sWQ6NcS/iXub94kqlSVW/sqfeu9qP41/A==",
"requires": {
"@types/dompurify": "^2.0.4",
"dompurify": "^2.0.15",
"eventemitter3": "^4.0.7"
},
"dependencies": {

2
package.json

@ -78,7 +78,7 @@
"short-uuid": "^3.1.1",
"sjcl": "^1.0.8",
"socket.io": "^2.3.0",
"sphinx-bot": "^0.1.9",
"sphinx-bot": "^0.1.12",
"tail": "^2.0.3",
"ts-node": "^8.5.4",
"tsc": "^1.20150623.0",

Loading…
Cancel
Save