Updated prompt and module
This commit is contained in:
1 parent
9f0b0df570
commit
e788b1b252
1 file changed
+17
-4
@@ -99,20 +99,25 @@ class BotChat {
|
|||||||
|
|
||||||
async outputFixup(str) {
|
async outputFixup(str) {
|
||||||
const outLines = str.trim().split("\n");
|
const outLines = str.trim().split("\n");
|
||||||
|
let outArr =[];
|
||||||
let outStr = "";
|
let outStr = "";
|
||||||
|
|
||||||
for (let ln of outLines) {
|
for (let ln of outLines) {
|
||||||
if(ln.startsWith("dank-bot:")) {
|
if(ln.startsWith("dank-bot:")) {
|
||||||
const trucStr = ln.replace("dank-bot:","");
|
const trucStr = ln.replace("dank-bot:","");
|
||||||
outStr += "\n" + trucStr.trim();
|
outStr += "\n" + trucStr.trim();
|
||||||
|
outArr.push(trucStr.trim());
|
||||||
} else if (ln.indexOf(":") > 0 && ln.indexOf(":") < 20 ) {
|
} else if (ln.indexOf(":") > 0 && ln.indexOf(":") < 20 ) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
outStr += ln;
|
outStr += "\n" + ln.trim();
|
||||||
|
outArr.push(ln.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return outStr.trim();
|
outArr = outArr.filter(s => s.trim().length > 0);
|
||||||
|
// return outStr.trim();
|
||||||
|
return outArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
async action(msg, botrandom) {
|
async action(msg, botrandom) {
|
||||||
@@ -124,8 +129,16 @@ class BotChat {
|
|||||||
console.log(`Input Text: ${input_text}`);
|
console.log(`Input Text: ${input_text}`);
|
||||||
const history = await this.getRecentChannelHistory(chan);
|
const history = await this.getRecentChannelHistory(chan);
|
||||||
const bot_response = await this.get_response(history,input_text);
|
const bot_response = await this.get_response(history,input_text);
|
||||||
const response_only = await this.outputFixup(bot_response);
|
const responses_only = await this.outputFixup(bot_response);
|
||||||
chan.send(response_only);
|
|
||||||
|
if (responses_only.length > 1) {
|
||||||
|
responses_only.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
for(let res of responses_only) {
|
||||||
|
await chan.send(res);
|
||||||
|
}
|
||||||
|
// chan.send(response_only);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
chan.send(`Error: ${e}`);
|
chan.send(`Error: ${e}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user