Actually support comma-split syntax in random

This commit is contained in:
Cohee
2024-04-02 01:16:25 +03:00
parent 36b718b9c7
commit 4f6127c8f2
2 changed files with 5 additions and 2 deletions

View File

@ -190,7 +190,10 @@ function randomReplace(input, emptyListPlaceholder = '') {
input = input.replace(randomPatternNew, (match, listString) => {
//split on double colons instead of commas to allow for commas inside random items
const list = listString.split('::').filter(item => item.length > 0);
const list = listString.includes('::')
? listString.split('::').filter(item => item.length > 0)
: listString.split(',').map(item => item.trim()).filter(item => item.length > 0);
if (list.length === 0) {
return emptyListPlaceholder;
}