mirror of
https://github.com/nullnyat/NullcatChan.git
synced 2025-08-07 04:43:49 +09:00
nannka
This commit is contained in:
40
src/modules/noting/index.ts
Normal file
40
src/modules/noting/index.ts
Normal 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
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user