Fix reddit command

This commit is contained in:
Supositware 2022-09-21 20:13:20 +02:00
parent 92c91928e7
commit 66736a5557

View file

@ -28,10 +28,15 @@ export default {
if (response.data.children[i].data.over_18 == true && !interaction.channel.nsfw) { if (response.data.children[i].data.over_18 == true && !interaction.channel.nsfw) {
return interaction.editReply('No nsfw'); return interaction.editReply('No nsfw');
} }
let description = response.data.children[i].data.selftext;
if (description === '') {
description = 'No description.';
}
const redditEmbed = new EmbedBuilder() const redditEmbed = new EmbedBuilder()
.setColor(interaction.member ? interaction.member.displayHexColor : 'Navy') .setColor(interaction.member ? interaction.member.displayHexColor : 'Navy')
.setTitle(response.data.children[i].data.title) .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) .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}` }); .setFooter({ text: `/r/${response.data.children[i].data.subreddit} | ⬆ ${response.data.children[i].data.ups} 🗨 ${response.data.children[i].data.num_comments}` });