diff --git a/package.json b/package.json index 4304e7a..d50e6ea 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "_v": "1.2.8", + "_v": "1.2.9", "main": "./built/index.js", "scripts": { "start": "node ./built", diff --git a/src/modules/poll/index.ts b/src/modules/poll/index.ts index c59bffc..e6a2295 100644 --- a/src/modules/poll/index.ts +++ b/src/modules/poll/index.ts @@ -25,7 +25,7 @@ export default class extends Module { @autobind private async post() { - const duration = 1000 * 60 * 10; + const duration = 1000 * 60 * 15; const polls = [ // TODO: Extract serif ['珍しそうなもの', 'みなさんは、どれがいちばん珍しいと思いますか?'], @@ -124,21 +124,29 @@ export default class extends Module { continue; } - // TODO: 同数一位のハンドリング if (choice.votes > mostVotedChoice.votes) { mostVotedChoice = choice; } } + const mostVotedChoices = choices.filter(choice => choice.votes === mostVotedChoice.votes); + if (mostVotedChoice.votes === 0) { this.ai.post({ // TODO: Extract serif text: '投票はありませんでした', renoteId: noteId, }); - } else { + } else if (mostVotedChoices.length === 1) { this.ai.post({ // TODO: Extract serif cw: `${title}アンケートの結果発表です!`, - text: `結果は${mostVotedChoice.votes}票を獲得した「${mostVotedChoice.text}」でした!`, + text: `結果は${mostVotedChoice.votes}票の「${mostVotedChoice.text}」でした!`, + renoteId: noteId, + }); + } else { + const choices = mostVotedChoices.map(choice => `「${choice.text}」`).join('と'); + this.ai.post({ // TODO: Extract serif + cw: `${title}アンケートの結果発表です!`, + text: `結果は${mostVotedChoice.votes}票の${choices}でした!`, renoteId: noteId, }); } diff --git a/src/vocabulary.ts b/src/vocabulary.ts index b74194f..ce12aae 100644 --- a/src/vocabulary.ts +++ b/src/vocabulary.ts @@ -91,6 +91,7 @@ export const itemPrefixes = [ '分散型', '卵かけ', '次世代', + '帯電', ]; export const items = [