Skip to content

Commit

Permalink
dry
Browse files Browse the repository at this point in the history
  • Loading branch information
Techbot121 authored and Meta Construct committed Jun 17, 2024
1 parent 21e12bd commit 5eb2ca8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/services/discord/modules/commands/Role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,15 @@ const addEmoji = async (
return;
}
if (custom) {
const emoji = ctx.client.emojis.resolve(custom[3]);
let emoji: Discord.GuildEmoji | Buffer | null = ctx.client.emojis.resolve(custom[3]);
if (!emoji) {
try {
const data = await axios
.get(`https://cdn.discordapp.com/emojis/${custom[3]}.png`, {
responseType: "arraybuffer",
})
.then(response => Buffer.from(response.data));
await role.setIcon(data);
await ctx.followUp(EphemeralResponse(`Set custom emoji sucessfully!`));
return;
emoji = data;
} catch (error) {
await ctx.followUp(
EphemeralResponse(`Couldn't get your emote for some reason 🤷‍♂️\n${error}`)
Expand Down

0 comments on commit 5eb2ca8

Please sign in to comment.