diff --git a/README.md b/README.md index 7a34ad1d..105d9648 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 463 +Total: 465 ### Utility: @@ -295,6 +295,7 @@ Total: 463 * **magic-conch:** Asks your question to the Magic Conch. * **name:** Responds with a random name, with the gender of your choice. * **never-have-i-ever:** Responds with a random "Never Have I Ever..." statement. +* **news:** Responds with a random news article. * **number-fact:** Responds with a random fact about a specific number. * **offspring:** Determines if your new child will be a boy or a girl. * **opinion:** Determines the opinion on something. @@ -332,6 +333,7 @@ Total: 463 * **fidget:** Responds with a random image of Fidget. * **fox:** Responds with a random fox image. * **hentai:** Responds with a random hentai image. (NSFW) +* **interesting:** Responds with a random interesting image. * **karen:** Responds with a random image of Karen. * **lando:** Responds with a random image of Lando Calrissian. * **light-novel-cover:** Responds with a randomly generated Light Novel cover. (NSFW) @@ -1303,7 +1305,9 @@ here. - [Reddit](https://www.reddit.com/) * awwnime ([API](https://www.reddit.com/dev/api/)) * hentai ([API](https://www.reddit.com/dev/api/)) + * interesting ([API](https://www.reddit.com/dev/api/)) * meme ([API](https://www.reddit.com/dev/api/)) + * news ([API](https://www.reddit.com/dev/api/)) * porn ([API](https://www.reddit.com/dev/api/)) * reddit ([API](https://www.reddit.com/dev/api/)) * shower-thought ([API](https://www.reddit.com/dev/api/)) diff --git a/assets/json/meme.json b/assets/json/meme.json index f0c9b79b..f1620598 100644 --- a/assets/json/meme.json +++ b/assets/json/meme.json @@ -11,5 +11,7 @@ "prequelmemes", "mothmemes", "meme", - "politicalhumor" + "politicalhumor", + "surrealmemes", + "gamingcirclejerk" ] diff --git a/assets/json/news.json b/assets/json/news.json new file mode 100644 index 00000000..d087864e --- /dev/null +++ b/assets/json/news.json @@ -0,0 +1,49 @@ +[ + "news", + "politics", + "movies", + "science", + "worldnews", + "entertainment", + "futurology", + "games", + "technology", + "technewstoday", + "gadgets", + "technews", + "tech", + "everythingscience", + "esports", + "television", + "space", + "baseball", + "hockey", + "apple", + "environment", + "spacex", + "economics", + "android", + "collegebasketball", + "medicine", + "iphone", + "privacy", + "psychology", + "economy", + "climate", + "business", + "energy", + "crpytomarkets", + "mlb", + "nature", + "finance", + "health", + "security", + "cfb", + "cryptocurrency", + "programming", + "nba", + "boxoffice", + "comicbooks", + "sports", + "celebrities" +] diff --git a/commands/random-img/interesting.js b/commands/random-img/interesting.js new file mode 100644 index 00000000..191011f6 --- /dev/null +++ b/commands/random-img/interesting.js @@ -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); + } +}; diff --git a/commands/random-res/news.js b/commands/random-res/news.js new file mode 100644 index 00000000..f507a0b3 --- /dev/null +++ b/commands/random-res/news.js @@ -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); + } +}; diff --git a/commands/random-res/subreddit.js b/commands/random-res/subreddit.js index aafa05cc..263f518f 100644 --- a/commands/random-res/subreddit.js +++ b/commands/random-res/subreddit.js @@ -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); } }; diff --git a/package.json b/package.json index f86d03ea..ca36ed9b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "116.8.2", + "version": "116.9.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { diff --git a/structures/commands/Subreddit.js b/structures/commands/Subreddit.js index 6ee918f4..1c7bb0f6 100644 --- a/structures/commands/Subreddit.js +++ b/structures/commands/Subreddit.js @@ -37,7 +37,7 @@ module.exports = class SubredditCommand extends Command { } makeEmbed(post, subreddit, icon) { - return new MessageEmbed() + const embed = new MessageEmbed() .setColor(0xFF4500) .setAuthor(`r/${subreddit}`, icon, `https://www.reddit.com/r/${subreddit}/`) .setTitle(shorten(post.title, 256)) @@ -45,6 +45,10 @@ module.exports = class SubredditCommand extends Command { .setURL(`https://www.reddit.com${post.permalink}`) .setTimestamp(post.created_utc * 1000) .setFooter(`⬆ ${formatNumberK(post.ups)}`); + if (post.thumbnail && post.thumbnail !== 'self' && post.post_hint !== 'image') { + embed.setThumbnail(post.thumbnail); + } + return embed; } async random(subreddit, nsfw) {