🚸 more logical meme command
This commit is contained in:
parent
50f070787c
commit
518ec431d8
1 changed files with 23 additions and 8 deletions
|
@ -11,11 +11,12 @@ export default {
|
||||||
builder: (command: SlashCommandSubcommandBuilder) => {
|
builder: (command: SlashCommandSubcommandBuilder) => {
|
||||||
return command.setName("meme").setDescription("Get a meme from r/memes)");
|
return command.setName("meme").setDescription("Get a meme from r/memes)");
|
||||||
},
|
},
|
||||||
|
|
||||||
execute: async (interaction: CommandInteraction) => {
|
execute: async (interaction: CommandInteraction) => {
|
||||||
if (interaction.guild == null) return;
|
const { guild } = interaction;
|
||||||
const { successColor, footerText, footerIcon } = await getEmbedConfig(
|
|
||||||
interaction.guild
|
const embedConfig = await getEmbedConfig(guild);
|
||||||
);
|
|
||||||
await axios
|
await axios
|
||||||
.get("https://www.reddit.com/r/memes/random/.json")
|
.get("https://www.reddit.com/r/memes/random/.json")
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
|
@ -23,14 +24,28 @@ export default {
|
||||||
const content = response[0].data;
|
const content = response[0].data;
|
||||||
|
|
||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setTitle(content.title)
|
.setAuthor({
|
||||||
|
name: content.title,
|
||||||
|
iconURL:
|
||||||
|
"https://www.redditinc.com/assets/images/site/reddit-logo.png",
|
||||||
|
url: `https://reddit.com${content.permalink}`,
|
||||||
|
})
|
||||||
|
.setTitle("[:sweat_smile:] Meme")
|
||||||
|
.addFields([
|
||||||
|
{ name: "Author", value: content.author, inline: true },
|
||||||
|
{
|
||||||
|
name: "Votes",
|
||||||
|
value: `${content.ups}/${content.downs}`,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
])
|
||||||
.setTimestamp(new Date())
|
.setTimestamp(new Date())
|
||||||
.setImage(content.url)
|
.setImage(content.url)
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: `👍 ${content.ups}︱👎 ${content.downs}\n${footerText}`,
|
text: embedConfig.footerText,
|
||||||
iconURL: footerIcon,
|
iconURL: embedConfig.footerIcon,
|
||||||
})
|
})
|
||||||
.setColor(successColor);
|
.setColor(embedConfig.successColor);
|
||||||
|
|
||||||
return interaction.editReply({ embeds: [embed] });
|
return interaction.editReply({ embeds: [embed] });
|
||||||
})
|
})
|
Loading…
Add table
Reference in a new issue