From 9e7a3611be577a53a0f3472413ac872c8c3bbbfa Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 17 Nov 2022 09:21:00 +0300 Subject: [PATCH] Update editor.js --- scripts/commands/channels/editor.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/commands/channels/editor.js b/scripts/commands/channels/editor.js index 3d679c12..d00ca358 100644 --- a/scripts/commands/channels/editor.js +++ b/scripts/commands/channels/editor.js @@ -90,7 +90,8 @@ async function getOptions(channel) { let variants = [] variants.push(`${channel.name.trim()} | ${generateCode(channel.name, defaultCountry)}${newLabel}`) similar.forEach(i => { - variants.push(`${i.name} | ${i.id} [api]`) + let alt_names = i.alt_names.length ? ` (${i.alt_names.join(',')})` : '' + variants.push(`${i.name}${alt_names} | ${i.id} [api]`) }) variants.push(`Overwrite...`) variants.push(`Skip...`) @@ -102,10 +103,10 @@ async function getSimilar(list, channel) { return list.filter(i => i.name .toLowerCase() - .replace(/\s|-|:/gi, '') + .replace(/[^a-z0-9]/gi, '') .startsWith( channel.name - .replace(/(\s|-|:)/gi, '') + .replace(/[^a-z0-9]/gi, '') .slice(0, 8) .toLowerCase() )