From ec60c779b6166c95839af2293a4ad46b40cec3aa Mon Sep 17 00:00:00 2001 From: Ayfri Date: Tue, 31 Aug 2021 06:14:09 +0200 Subject: [PATCH] feat: Add isSnowflake function. --- src/utils/utils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/utils.ts b/src/utils/utils.ts index f900cd4..371d1e8 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -36,6 +36,10 @@ export function isOwner(id: Snowflake) { return CommandHandler.owners?.includes(id) ?? false; } +export function isSnowflake(value: string): value is Snowflake { + return /\d{17,19}/.test(value); +} + /** * Returns true if the value is a TextChannel or a NewsChannel. *