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
+5 -1
View File
@@ -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/))
+3 -1
View File
@@ -11,5 +11,7 @@
"prequelmemes",
"mothmemes",
"meme",
"politicalhumor"
"politicalhumor",
"surrealmemes",
"gamingcirclejerk"
]
+49
View File
@@ -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"
]
+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);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "116.8.2",
"version": "116.9.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
+5 -1
View File
@@ -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) {