Compare commits
No commits in common. "dda9ba81ae43c2add664183eef7b1cafb99685c5" and "5b4b5d3c0fc0db3bde10c74baee5bd83d6016927" have entirely different histories.
dda9ba81ae
...
5b4b5d3c0f
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.17.3",
|
"version": "1.17.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.17.3",
|
"version": "1.17.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bhttp": "^1.2.8",
|
"bhttp": "^1.2.8",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.17.3",
|
"version": "1.17.2",
|
||||||
"description": "Game host for SChat 2-powered chat sites",
|
"description": "Game host for SChat 2-powered chat sites",
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -13,7 +13,7 @@ const contemplations = [
|
||||||
'Let\'s see...',
|
'Let\'s see...',
|
||||||
];
|
];
|
||||||
|
|
||||||
const answersByType = {
|
const answers = {
|
||||||
positive: [
|
positive: [
|
||||||
'It is certain',
|
'It is certain',
|
||||||
'It is decidedly so',
|
'It is decidedly so',
|
||||||
|
@ -42,7 +42,6 @@ const answersByType = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const answers = Object.entries(answersByType).flatMap(([type, typeAnswers]) => typeAnswers.map((answer) => ({ answer, type })));
|
|
||||||
const questions = new Map();
|
const questions = new Map();
|
||||||
|
|
||||||
function purgeQuestions() {
|
function purgeQuestions() {
|
||||||
|
@ -66,16 +65,13 @@ async function onCommand(args, context) {
|
||||||
? stringSimilarity.findBestMatch(question, Array.from(questions.keys())).bestMatch
|
? stringSimilarity.findBestMatch(question, Array.from(questions.keys())).bestMatch
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const similarQuestionType = similarQuestion?.rating > 0.6 && questions.get(similarQuestion.target)?.type;
|
const answerType = similarQuestion?.rating > 0.5
|
||||||
|
? questions.get(similarQuestion.target).answerType
|
||||||
|
: Object.keys(answers)[crypto.randomInt(0, 3)];
|
||||||
|
|
||||||
const { answer, type } = similarQuestionType
|
const answer = answers[answerType][crypto.randomInt(0, answers[answerType].length)];
|
||||||
? {
|
|
||||||
answer: answersByType[similarQuestionType][crypto.randomInt(0, answersByType[similarQuestionType].length)],
|
|
||||||
type: similarQuestionType,
|
|
||||||
}
|
|
||||||
: answers[crypto.randomInt(0, answers.length)];
|
|
||||||
|
|
||||||
questions.set(question, { type, timestamp: new Date() });
|
questions.set(question, { answerType, timestamp: new Date() });
|
||||||
|
|
||||||
context.sendMessage(`🎱 ${contemplations[crypto.randomInt(0, contemplations.length)]}`, context.room.id, { label: false });
|
context.sendMessage(`🎱 ${contemplations[crypto.randomInt(0, contemplations.length)]}`, context.room.id, { label: false });
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue