From e3ae229f5be8be2e9b2d334775347b1a70029c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hegyi=20=C3=81ron=20Ferenc?= Date: Tue, 31 Oct 2023 16:53:13 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20choose=20random=20emoji=20i?= =?UTF-8?q?f=20multiple=20are=20given?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/emojis.json | 3 ++- src/main.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/emojis.json b/src/emojis.json index 6dc64bc..cabf0fd 100644 --- a/src/emojis.json +++ b/src/emojis.json @@ -11,7 +11,8 @@ "release": "๐Ÿ”–", "cleanup": "๐Ÿงน", "license": "๐Ÿ“œ", - "deps": "๐Ÿ“ฆ" + "deps": "๐Ÿ“ฆ", + "readme": "๐Ÿ“•,๐Ÿ“—,๐Ÿ“˜,๐Ÿ“™" }, "release": "๐Ÿ”–", "cleanup": "๐Ÿงน", diff --git a/src/main.ts b/src/main.ts index 2bd0d03..7d8b807 100644 --- a/src/main.ts +++ b/src/main.ts @@ -89,6 +89,9 @@ export function eemojify(text: string, config: Config): string { if (!emoji) throw new Error(`Emoji for type "${type}" not found.`) + if (emoji.includes(',')) + emoji = emoji.trim().split(',')[Math.floor(Math.random() * emoji.split(',').length)] ?? emoji + return config.format .replace('{emoji}', emoji) .replace('{type}', type)