This commit is contained in:
syuilo
2020-08-31 20:46:00 +09:00
parent ba0a99b072
commit fa0ebcdb8f
6 changed files with 125 additions and 29 deletions

View File

@ -0,0 +1,40 @@
import autobind from 'autobind-decorator';
import Module from '../../module';
import serifs from '../../serifs';
import { genItem } from '../../vocabulary';
export default class extends Module {
public readonly name = 'noting';
@autobind
public install() {
setInterval(() => {
if (Math.random() < 0.05) {
this.post();
}
}, 1000 * 60 * 10);
return {};
}
@autobind
private post() {
const notes = [
...serifs.noting.notes,
() => {
const item = genItem();
return serifs.noting.want(item);
},
() => {
const item = genItem();
return serifs.noting.see(item);
},
];
const note = notes[Math.floor(Math.random() * notes.length)];
this.ai.post({
text: typeof note === 'function' ? note() : note
});
}
}