Browse Source

detect did emit

push-params
Evan Feenstra 4 years ago
parent
commit
3a581d7ac4
  1. 15
      api/network/intercept.ts
  2. 14
      dist/api/network/intercept.js
  3. 2
      dist/api/network/intercept.js.map

15
api/network/intercept.ts

@ -2,10 +2,6 @@ import {Msg} from './interfaces'
import { models } from '../models'
import {builtinBotEmit} from '../bots'
const defaultPrefixes = [
'/bot' //, '/welcome'
]
/*
default show or not
restrictions (be able to toggle, or dont show chat)
@ -22,13 +18,12 @@ export async function isBotMsg(msg:Msg, sentByMe:boolean): Promise<boolean> {
let didEmit = false
defaultPrefixes.forEach(p=>{
if(txt.startsWith(`${p} `)) {
builtinBotEmit(msg)
didEmit = true
}
})
if(txt.startsWith('/bot ')) {
builtinBotEmit(msg)
didEmit = true
}
console.log("DID EMIT",didEmit)
if(didEmit) return didEmit
const botsInTribe = await models.ChatBot.findAll({where:{

14
dist/api/network/intercept.js

@ -11,9 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", { value: true });
const models_1 = require("../models");
const bots_1 = require("../bots");
const defaultPrefixes = [
'/bot' //, '/welcome'
];
/*
default show or not
restrictions (be able to toggle, or dont show chat)
@ -29,12 +26,11 @@ function isBotMsg(msg, sentByMe) {
if (!chat)
return false;
let didEmit = false;
defaultPrefixes.forEach(p => {
if (txt.startsWith(`${p} `)) {
bots_1.builtinBotEmit(msg);
didEmit = true;
}
});
if (txt.startsWith('/bot ')) {
bots_1.builtinBotEmit(msg);
didEmit = true;
}
console.log("DID EMIT", didEmit);
if (didEmit)
return didEmit;
const botsInTribe = yield models_1.models.ChatBot.findAll({ where: {

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

@ -1 +1 @@
{"version":3,"file":"intercept.js","sourceRoot":"","sources":["../../../api/network/intercept.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,sCAAkC;AAClC,kCAAsC;AAEtC,MAAM,eAAe,GAAG;IACtB,MAAM,CAAC,cAAc;CACtB,CAAA;AAED;;;EA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