Comparing version 2.1.2 to 2.1.3
import { MarkovGenerateOptions, MarkovResult } from "markov-strings"; | ||
interface ICrispyOptions { | ||
[key: string]: any; | ||
cooldown: number; | ||
stateSize: number; | ||
minLength: number; | ||
minWords: number; | ||
minScore: number; | ||
cooldown?: number; | ||
stateSize?: number; | ||
minLength?: number; | ||
minWords?: number; | ||
minScore?: number; | ||
maxTries?: number; | ||
@@ -10,0 +10,0 @@ prng?: () => number; |
@@ -14,10 +14,4 @@ "use strict"; | ||
this.user = {}; | ||
this.options = options; | ||
this.cooldown = new Set(); | ||
this.options = Object.assign({}, { | ||
cooldown: 5, | ||
minLength: 0, | ||
minScore: 0, | ||
minWords: 0, | ||
stateSize: 3, | ||
}, options); | ||
this.db = low(new FileSync("db.json")); | ||
@@ -58,6 +52,6 @@ this.db.defaults({ messages: [] }).write(); | ||
this.options.filter = (result) => { | ||
return result.string.length >= this.options.minLength && | ||
result.string.split(" ").length >= this.options.minWords && | ||
return result.string.length >= (this.options.minLength || 0) && | ||
result.string.split(" ").length >= (this.options.minWords || 0) && | ||
!result.refs.map((o) => o.string).includes(result.string) && | ||
result.score >= this.options.minScore && | ||
result.score >= (this.options.minScore || 0) && | ||
!this.cooldown.has(result.string); | ||
@@ -67,3 +61,3 @@ }; | ||
this._initCorpus(); | ||
setInterval(this.cleanCooldown, this.options.cooldown * 1000 * 60); | ||
setInterval(this.cleanCooldown, (this.options.cooldown || 5) * 1000 * 60); | ||
} | ||
@@ -70,0 +64,0 @@ get io() { |
{ | ||
"name": "crispybot", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "An annoying bot.", | ||
@@ -5,0 +5,0 @@ "main": "dist/crispy.js", |
@@ -24,7 +24,7 @@ /** | ||
[key: string]: any; | ||
cooldown: number; | ||
stateSize: number; | ||
minLength: number; | ||
minWords: number; | ||
minScore: number; | ||
cooldown?: number; | ||
stateSize?: number; | ||
minLength?: number; | ||
minWords?: number; | ||
minScore?: number; | ||
maxTries?: number; | ||
@@ -53,12 +53,4 @@ prng?: () => number; | ||
this.user = {}; | ||
this.options = options; | ||
this.cooldown = new Set(); | ||
this.options = Object.assign({}, { | ||
cooldown: 5, | ||
minLength: 0, | ||
minScore: 0, | ||
minWords: 0, | ||
stateSize: 3, | ||
}, options); | ||
this.db = low(new FileSync("db.json")); | ||
@@ -101,6 +93,6 @@ this.db.defaults({ messages: [] }).write(); | ||
this.options.filter = (result: MarkovResult) => { | ||
return result.string.length >= this.options.minLength && | ||
result.string.split(" ").length >= this.options.minWords && | ||
return result.string.length >= (this.options.minLength || 0) && | ||
result.string.split(" ").length >= (this.options.minWords || 0) && | ||
!result.refs.map((o) => o.string).includes(result.string) && | ||
result.score >= this.options.minScore && | ||
result.score >= (this.options.minScore || 0) && | ||
!this.cooldown.has(result.string); | ||
@@ -111,3 +103,3 @@ }; | ||
this._initCorpus(); | ||
setInterval(this.cleanCooldown, this.options.cooldown * 1000 * 60); | ||
setInterval(this.cleanCooldown, (this.options.cooldown || 5) * 1000 * 60); | ||
} | ||
@@ -114,0 +106,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
79055
714