This commit is contained in:
syuilo 2020-08-30 10:16:18 +09:00
parent 622b021ba2
commit ba0a99b072
2 changed files with 25 additions and 1 deletions

View file

@ -25,7 +25,8 @@ export default class extends Module {
return ( return (
this.transferBegin(msg) || this.transferBegin(msg) ||
this.transferEnd(msg) || this.transferEnd(msg) ||
this.setName(msg) this.setName(msg) ||
this.modules(msg)
); );
} }
@ -107,6 +108,24 @@ export default class extends Module {
return true; return true;
} }
@autobind
private modules(msg: Message): boolean {
if (!msg.text) return false;
if (!msg.or(['modules'])) return false;
let text = '```\n';
for (const m of this.ai.modules) {
text += `${m.name}\n`;
}
text += '```';
msg.reply(text);
return true;
}
@autobind @autobind
private async contextHook(msg: Message, data: any) { private async contextHook(msg: Message, data: any) {
if (msg.text == null) return; if (msg.text == null) return;

View file

@ -14,6 +14,11 @@ export default function(text: string, words: (string | RegExp)[]): boolean {
function denoise(text: string): string { function denoise(text: string): string {
text = text.trim(); text = text.trim();
if (text.startsWith('@')) {
text = text.replace(/^@[a-zA-Z0-1\-_]+/, '');
text = text.trim();
}
function fn() { function fn() {
text = text.replace(/[!]+$/, ''); text = text.replace(/[!]+$/, '');
text = text.replace(/っ+$/, ''); text = text.replace(/っ+$/, '');