From ab74c17ebd7d86f6c186fceec5379cd71d7b780d Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Sat, 2 Dec 2023 20:55:17 -1000 Subject: [PATCH] fix: Make emoji importing warn you if the emoji already exists earlier --- cli.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/cli.ts b/cli.ts index be12b5ee..3a5cd9b5 100644 --- a/cli.ts +++ b/cli.ts @@ -921,23 +921,6 @@ switch (command) { let emojisCreated = 0; for (const [name, path] of Object.entries(pack_response)) { - // Get emoji URL, as it can be relative - - const emoji = Bun.file(`${tempDirectory}/${path}`); - - const content_type = emoji.type; - - const hash = await uploadFile(emoji as File, config); - - if (!hash) { - console.log( - `${chalk.red(`✗`)} Failed to upload emoji ${name}` - ); - process.exit(1); - } - - const finalUrl = getUrl(hash, config); - // Check if emoji already exists const existingEmoji = await client.emoji.findFirst({ where: { @@ -955,6 +938,23 @@ switch (command) { continue; } + // Get emoji URL, as it can be relative + + const emoji = Bun.file(`${tempDirectory}/${path}`); + + const content_type = emoji.type; + + const hash = await uploadFile(emoji as File, config); + + if (!hash) { + console.log( + `${chalk.red(`✗`)} Failed to upload emoji ${name}` + ); + process.exit(1); + } + + const finalUrl = getUrl(hash, config); + // Create emoji await client.emoji.create({ data: {