uhoize fix
This commit is contained in:
parent
ec64c9da11
commit
9d02079890
|
@ -218,7 +218,7 @@ function save() {
|
|||
claimAchievement('markedAsCat');
|
||||
}
|
||||
if (profile.isGorilla) {
|
||||
claimAchievement('markedAsCat');
|
||||
claimAchievement('markedAsGorilla');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue