News and Interesting Commands

This commit is contained in:
Dragon Fire
2020-06-08 16:49:21 -04:00
parent 5d6557ff76
commit 1592041760
8 changed files with 128 additions and 9 deletions
+33
View File
@@ -0,0 +1,33 @@
const SubredditCommand = require('../../structures/commands/Subreddit');
const { list } = require('../../util/Util');
const subreddits = ['interestingasfuck', 'mildlyinteresting'];
module.exports = class InterestingCommand extends SubredditCommand {
constructor(client) {
super(client, {
name: 'interesting',
aliases: ['interesting-as-fuck', 'mildly-interesting'],
group: 'random-img',
memberName: 'interesting',
description: 'Responds with a random interesting image.',
details: `**Subreddits:** ${subreddits.join(', ')}`,
clientPermissions: ['EMBED_LINKS'],
postType: 'image',
getIcon: true,
args: [
{
key: 'subreddit',
prompt: `What subreddit do you want to get memes from? Either ${list(subreddits, 'or')}.`,
type: 'string',
oneOf: subreddits,
default: () => subreddits[Math.floor(Math.random() * subreddits.length)],
parse: subreddit => subreddit.toLowerCase()
}
]
});
}
generateText(post, subreddit, icon) {
return this.makeEmbed(post, subreddit, icon);
}
};
+31
View File
@@ -0,0 +1,31 @@
const SubredditCommand = require('../../structures/commands/Subreddit');
const { list } = require('../../util/Util');
const subreddits = require('../../assets/json/news');
module.exports = class NewsCommand extends SubredditCommand {
constructor(client) {
super(client, {
name: 'news',
group: 'random-res',
memberName: 'news',
description: 'Responds with a random news article.',
details: `**Subreddits:** ${subreddits.join(', ')}`,
clientPermissions: ['EMBED_LINKS'],
getIcon: true,
args: [
{
key: 'subreddit',
prompt: `What subreddit do you want to get news from? Either ${list(subreddits, 'or')}.`,
type: 'string',
oneOf: subreddits,
default: () => subreddits[Math.floor(Math.random() * subreddits.length)],
parse: subreddit => subreddit.toLowerCase()
}
]
});
}
generateText(post, subreddit, icon) {
return this.makeEmbed(post, subreddit, icon);
}
};
+1 -5
View File
@@ -23,10 +23,6 @@ module.exports = class SubredditCommand extends SubredditCommandBase {
}
generateText(post, subreddit, icon) {
const embed = this.makeEmbed(post, subreddit, icon);
if (post.thumbnail && post.thumbnail !== 'self' && post.post_hint !== 'image') {
embed.setThumbnail(post.thumbnail);
}
return embed;
return this.makeEmbed(post, subreddit, icon);
}
};