uhoize fix

This commit is contained in:
mattyatea 2023-11-04 10:12:13 +09:00
parent ec64c9da11
commit 9d02079890
2 changed files with 21 additions and 5 deletions

View File

@ -218,7 +218,7 @@ function save() {
claimAchievement('markedAsCat');
}
if (profile.isGorilla) {
claimAchievement('markedAsCat');
claimAchievement('markedAsGorilla');
}
}

View File

@ -1,8 +1,23 @@
function uhoize(str) {
const punctuation = ['。', '', '', '.', '!', '?'];
let lines = str.split('\n');
let voice = 'ウホ';
return lines.map(line => {
if (Math.floor(Math.random() * 2) === 0) {
voice = 'ウホッ'
} else {
voice = 'ウホ'
}
let lastChar = line.trim().slice(-1);
if (punctuation.includes(lastChar)) {
let lineWithoutPunctuation = line.trim().slice(0, -1);
return lineWithoutPunctuation + voice + lastChar;
} else {
return line + voice;
}
}).join('\n');
}
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
export function uhoize(text) {
const gorillaNoises = ['ウホ', 'ウホホ', 'ウホッ'];
let result = '';
@ -26,3 +41,4 @@ export function uhoize(text) {
}
return result;
}
*/