mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 15:57:54 +02:00
Reduce duplicate code in subreddit commands
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const SubredditCommand = require('../../structures/commands/Subreddit');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const { list, formatNumberK } = require('../../util/Util');
|
||||
const { list } = require('../../util/Util');
|
||||
const subreddits = require('../../assets/json/meme');
|
||||
|
||||
module.exports = class MemeCommand extends SubredditCommand {
|
||||
@@ -28,13 +27,6 @@ module.exports = class MemeCommand extends SubredditCommand {
|
||||
}
|
||||
|
||||
generateText(post, subreddit, icon) {
|
||||
return new MessageEmbed()
|
||||
.setColor(0xFF4500)
|
||||
.setAuthor(`r/${subreddit}`, icon, `https://www.reddit.com/r/${subreddit}/`)
|
||||
.setTitle(post.title)
|
||||
.setImage(post.post_hint === 'image' ? post.url : null)
|
||||
.setURL(`https://www.reddit.com${post.permalink}`)
|
||||
.setTimestamp(post.created_utc * 1000)
|
||||
.setFooter(`⬆ ${formatNumberK(post.ups)}`);
|
||||
return this.makeEmbed(post, subreddit, icon);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user