From 66736a555717b2859fe8c465b0dcec2acb68dcd9 Mon Sep 17 00:00:00 2001 From: Supositware Date: Wed, 21 Sep 2022 20:13:20 +0200 Subject: [PATCH] Fix reddit command --- commands/fun/reddit.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/commands/fun/reddit.js b/commands/fun/reddit.js index d23c07a..ced0ad3 100644 --- a/commands/fun/reddit.js +++ b/commands/fun/reddit.js @@ -28,10 +28,15 @@ export default { if (response.data.children[i].data.over_18 == true && !interaction.channel.nsfw) { return interaction.editReply('No nsfw'); } + + let description = response.data.children[i].data.selftext; + if (description === '') { + description = 'No description.'; + } const redditEmbed = new EmbedBuilder() .setColor(interaction.member ? interaction.member.displayHexColor : 'Navy') .setTitle(response.data.children[i].data.title) - .setDescription(response.data.children[i].data.selftext) + .setDescription(description) .setURL('https://reddit.com' + response.data.children[i].data.permalink) .setFooter({ text: `/r/${response.data.children[i].data.subreddit} | ⬆ ${response.data.children[i].data.ups} 🗨 ${response.data.children[i].data.num_comments}` });