mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 22:32:50 +02:00
News and Interesting Commands
This commit is contained in:
@@ -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);
|
||||
}
|
||||
};
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user