mirror of
https://github.com/JonnyBro/JaBa.git
synced 2025-04-01 03:32:00 +05:00
refactor: trycatch in ademoji command
This commit is contained in:
parent
9212f21acb
commit
150b687fbe
1 changed files with 11 additions and 14 deletions
|
@ -48,20 +48,17 @@ export const run = async ({ interaction }: SlashCommandProps) => {
|
||||||
const link = interaction.options.getString("link") || "",
|
const link = interaction.options.getString("link") || "",
|
||||||
name = interaction.options.getString("name") || "";
|
name = interaction.options.getString("name") || "";
|
||||||
|
|
||||||
interaction.guild?.emojis
|
try {
|
||||||
.create({
|
const emoji = await interaction.guild?.emojis.create({
|
||||||
name: name,
|
name,
|
||||||
attachment: link,
|
attachment: link,
|
||||||
})
|
|
||||||
.then(emoji =>
|
|
||||||
replySuccess(interaction, "administration/stealemoji:SUCCESS", {
|
|
||||||
emoji: emoji.toString(),
|
|
||||||
}, { edit: true }),
|
|
||||||
)
|
|
||||||
.catch(e => {
|
|
||||||
replyError(interaction, "administration/stealemoji:ERROR", {
|
|
||||||
name,
|
|
||||||
e,
|
|
||||||
}, { edit: true });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!emoji) return replyError(interaction, "administration/addemoji:ERROR", { name }, { edit: true });
|
||||||
|
|
||||||
|
return replySuccess(interaction, "administration/addemoji:SUCCESS", { emoji: emoji.toString() }, { edit: true });
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error, "ADDING EMOJI");
|
||||||
|
replyError(interaction, "administration/addemoji:ERROR", { name, error }, { edit: true });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue