Skip to content

Commit

Permalink
Refactor emoji upload logic to handle failed uploads and log errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chimpdev committed May 3, 2024
1 parent c538a03 commit 5aeb686
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/src/bot/commands/emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ module.exports = {
name: `${pack.name}_${pack.emoji_ids.indexOf(emoji) + 1}`,
reason: `Uploaded by @${interaction.user.username} (${interaction.user.id}) from pack ${packId}. ${index} of ${pack.emoji_ids.length} emojis.`
}).catch(() => null);
if (!createdEmoji) return message.edit({ content: `Failed uploading ${index}. Emoji. Skipping.. **${pack.emoji_ids.length - index} seconds** estimated.` });
if (!createdEmoji) {
message.edit({ content: `Failed uploading ${index}. Emoji. Skipping.. **${pack.emoji_ids.length - index} seconds** estimated.` });
logger.send(`Failed to upload emoji ${emoji.id} from pack ${packId} to ${interaction.guild.id}`);

await sleep(1000);

continue;
}

logger.send(`Uploaded emoji ${emoji.id} from pack ${packId} to ${interaction.guild.id}`);
createdEmojis.push({ emoji: createdEmoji, index });
Expand Down

0 comments on commit 5aeb686

Please sign in to comment.