From 804e8fcdd4da31428bfa3eb3d8fab47e96f8799d Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Fri, 12 Oct 2018 23:26:33 +0000 Subject: [PATCH] Embed reddit and meme --- commands/random/meme.js | 13 ++++++++----- commands/random/reddit.js | 13 ++++++++----- package.json | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/commands/random/meme.js b/commands/random/meme.js index 1a73392a..9957fd2c 100644 --- a/commands/random/meme.js +++ b/commands/random/meme.js @@ -1,5 +1,5 @@ const SubredditCommand = require('../../structures/commands/Subreddit'); -const { stripIndents } = require('common-tags'); +const { MessageEmbed } = require('discord.js'); const { list } = require('../../util/Util'); const subreddits = require('../../assets/json/meme'); @@ -27,9 +27,12 @@ module.exports = class MemeCommand extends SubredditCommand { } generateText(post, subreddit) { - return stripIndents` - **r/${subreddit}** ${post.title} - ${post.url} - `; + return new MessageEmbed() + .setColor(0xFF4500) + .setAuthor(`r/${subreddit}`, 'https://i.imgur.com/DSBOK0P.png', `https://www.reddit.com/r/${subreddit}/`) + .setTitle(post.title) + .setImage(post.post_hint === 'image' ? post.url : null) + .setURL(`https://www.reddit.com${post.permalink}`) + .setFooter(`⬆ ${post.ups}`); } }; diff --git a/commands/random/reddit.js b/commands/random/reddit.js index dcc6c527..40d7ca0a 100644 --- a/commands/random/reddit.js +++ b/commands/random/reddit.js @@ -1,5 +1,5 @@ const SubredditCommand = require('../../structures/commands/Subreddit'); -const { stripIndents } = require('common-tags'); +const { MessageEmbed } = require('discord.js'); module.exports = class RedditCommand extends SubredditCommand { constructor(client) { @@ -22,9 +22,12 @@ module.exports = class RedditCommand extends SubredditCommand { } generateText(post, subreddit) { - return stripIndents` - **r/${subreddit}** ${post.title} - ${post.url} - `; + return new MessageEmbed() + .setColor(0xFF4500) + .setAuthor(`r/${subreddit}`, 'https://i.imgur.com/DSBOK0P.png', `https://www.reddit.com/r/${subreddit}/`) + .setTitle(post.title) + .setImage(post.post_hint === 'image' ? post.url : null) + .setURL(`https://www.reddit.com${post.permalink}`) + .setFooter(`⬆ ${post.ups}`); } }; diff --git a/package.json b/package.json index 9b4cb9f8..d96e44c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "94.1.0", + "version": "94.1.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {