mirror of
https://github.com/syuilo/ai.git
synced 2024-11-22 05:08:00 +00:00
a
This commit is contained in:
parent
0ad7d63901
commit
65489087cd
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"_v": "1.2.8",
|
"_v": "1.2.9",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./built",
|
"start": "node ./built",
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default class extends Module {
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
private async post() {
|
private async post() {
|
||||||
const duration = 1000 * 60 * 10;
|
const duration = 1000 * 60 * 15;
|
||||||
|
|
||||||
const polls = [ // TODO: Extract serif
|
const polls = [ // TODO: Extract serif
|
||||||
['珍しそうなもの', 'みなさんは、どれがいちばん珍しいと思いますか?'],
|
['珍しそうなもの', 'みなさんは、どれがいちばん珍しいと思いますか?'],
|
||||||
|
@ -124,21 +124,29 @@ export default class extends Module {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 同数一位のハンドリング
|
|
||||||
if (choice.votes > mostVotedChoice.votes) {
|
if (choice.votes > mostVotedChoice.votes) {
|
||||||
mostVotedChoice = choice;
|
mostVotedChoice = choice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mostVotedChoices = choices.filter(choice => choice.votes === mostVotedChoice.votes);
|
||||||
|
|
||||||
if (mostVotedChoice.votes === 0) {
|
if (mostVotedChoice.votes === 0) {
|
||||||
this.ai.post({ // TODO: Extract serif
|
this.ai.post({ // TODO: Extract serif
|
||||||
text: '投票はありませんでした',
|
text: '投票はありませんでした',
|
||||||
renoteId: noteId,
|
renoteId: noteId,
|
||||||
});
|
});
|
||||||
} else {
|
} else if (mostVotedChoices.length === 1) {
|
||||||
this.ai.post({ // TODO: Extract serif
|
this.ai.post({ // TODO: Extract serif
|
||||||
cw: `${title}アンケートの結果発表です!`,
|
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,
|
renoteId: noteId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ export const itemPrefixes = [
|
||||||
'分散型',
|
'分散型',
|
||||||
'卵かけ',
|
'卵かけ',
|
||||||
'次世代',
|
'次世代',
|
||||||
|
'帯電',
|
||||||
];
|
];
|
||||||
|
|
||||||
export const items = [
|
export const items = [
|
||||||
|
|
Loading…
Reference in a new issue