mirror of
https://github.com/syuilo/ai.git
synced 2024-11-24 22:01:07 +00:00
Fix bug
This commit is contained in:
parent
7206dc0dc6
commit
28826e145a
|
@ -28,6 +28,12 @@ export default class Message {
|
|||
return this.messageOrNote.text;
|
||||
}
|
||||
|
||||
public get extractedText(): string {
|
||||
return this.text
|
||||
.replace(new RegExp(`^@${this.ai.account.username}(@.+?)?\s?`, 'i'), '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
public get replyId(): string {
|
||||
return this.messageOrNote.replyId;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ export default class extends Module {
|
|||
return;
|
||||
}
|
||||
|
||||
const guess = msg.text.toLowerCase().replace(this.ai.account.username.toLowerCase(), '').match(/[0-9]+/);
|
||||
const guess = msg.extractedText.match(/[0-9]+/);
|
||||
|
||||
if (guess == null) {
|
||||
msg.reply(serifs.guessingGame.nan).then(reply => {
|
||||
|
|
|
@ -85,7 +85,7 @@ export default class extends Module {
|
|||
// 既に数字を取っていたら
|
||||
if (game.votes.some(x => x.user.id == msg.userId)) return;
|
||||
|
||||
const match = msg.text.match(/[0-9]+/);
|
||||
const match = msg.extractedText.match(/[0-9]+/);
|
||||
if (match == null) return;
|
||||
|
||||
const num = parseInt(match[0], 10);
|
||||
|
|
Loading…
Reference in a new issue