Can you not, embed NASA, DM-usable random-user

This commit is contained in:
Daniel Odendahl Jr
2019-02-21 18:01:42 +00:00
parent 396905c5d9
commit 86dbc6553d
7 changed files with 40 additions and 8 deletions
+2 -1
View File
@@ -47,7 +47,7 @@ Xiao is a Discord bot coded in JavaScript with
7. Run `npm i -g pm2` to install PM2.
8. Run `pm2 start Xiao.js --name xiao` to run the bot.
## Commands (339)
## Commands (340)
### Utility:
* **eval:** Executes JavaScript code.
@@ -125,6 +125,7 @@ Xiao is a Discord bot coded in JavaScript with
### Single Response:
* **can-you-not:** Can YOU not?
* **dark-light:** Determines whether you use dark or light theme.
* **eat-pant:** Eat pant.
* **eggs-get-laid:** Sends the ultimate roast.
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class ApodCommand extends Command {
)
.setImage(body.media_type === 'image' ? body.url : null)
.setURL(body.url)
.setFooter(`Image Credits: ${body.copyright || 'Public Domain'}`)
.setFooter(`Image Credits: ${body.copyright ? body.copyright.replace(/\n/g, '/') : 'Public Domain'}`)
.setTimestamp();
return msg.embed(embed);
} catch (err) {
+5 -2
View File
@@ -7,12 +7,15 @@ module.exports = class RandomUserCommand extends Command {
aliases: ['member-roulette', 'user-roulette', 'random-member'],
group: 'random',
memberName: 'random-user',
description: 'Randomly chooses a member of the server.',
guildOnly: true
description: 'Randomly chooses a member of the server.'
});
}
run(msg) {
if (msg.channel.type === 'dm') {
const members = [this.client.user, msg.channel.recipient];
return msg.say(`I choose ${members[Math.floor(Math.random() * members.length)].username}!`);
}
return msg.say(`I choose ${msg.guild.members.random().displayName}!`);
}
};
+12 -2
View File
@@ -1,5 +1,6 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { MessageEmbed } = require('discord.js');
const { shorten } = require('../../util/Util');
module.exports = class NASACommand extends Command {
@@ -9,7 +10,7 @@ module.exports = class NASACommand extends Command {
group: 'search',
memberName: 'nasa',
description: 'Searches NASA\'s image archive for your query.',
clientPermissions: ['ATTACH_FILES'],
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'query',
@@ -31,7 +32,16 @@ module.exports = class NASACommand extends Command {
const images = body.collection.items;
if (!images.length) return msg.say('Could not find any results.');
const data = images[Math.floor(Math.random() * images.length)];
return msg.say(shorten(data.data[0].description), { files: [data.links[0].href] });
const embed = new MessageEmbed()
.setTitle(data.data[0].title)
.setDescription(shorten(data.data[0].description))
.setColor(0x2E528E)
.setAuthor('NASA', 'https://i.imgur.com/Wh8jY9c.png', 'https://www.nasa.gov/multimedia/imagegallery/index.html')
.setImage(data.links[0].href)
.setURL(data.links[0].href)
.setFooter(`Image Credits: ${data.data[0].center || 'Public Domain'}`)
.setTimestamp(new Date(data.data[0].date_created));
return msg.embed(embed);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+18
View File
@@ -0,0 +1,18 @@
const Command = require('../../structures/Command');
module.exports = class CanYouNotCommand extends Command {
constructor(client) {
super(client, {
name: 'can-you-not',
aliases: ['can-u-not'],
group: 'single',
memberName: 'can-you-not',
description: 'Can YOU not?',
patterns: [/can (you|u) not/i]
});
}
run(msg) {
return msg.reply('Can YOU not?');
}
};
+1 -1
View File
@@ -11,7 +11,7 @@ module.exports = class InfoCommand extends Command {
constructor(client) {
super(client, {
name: 'info',
aliases: ['stats'],
aliases: ['stats', 'uptime'],
group: 'util',
memberName: 'info',
description: 'Responds with detailed bot information.',
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "101.8.0",
"version": "101.9.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {