Vocaloid Upgrade, Steam Change, Fix Portal

This commit is contained in:
Daniel Odendahl Jr
2017-07-30 21:50:20 +00:00
parent a3d49130b3
commit ad17cef133
8 changed files with 58 additions and 64 deletions
-18
View File
@@ -1,18 +0,0 @@
const Command = require('../../structures/Command');
const songs = require('../../assets/json/vocaloid');
module.exports = class VocaloidCommand extends Command {
constructor(client) {
super(client, {
name: 'vocaloid',
group: 'random-res',
memberName: 'vocaloid',
description: 'Responds with a random VOCALOID song.'
});
}
run(msg) {
const song = songs[Math.floor(Math.random() * songs.length)];
return msg.say(song);
}
};
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = class PortalSendCommand extends Command {
async run(msg, args) {
const { message } = args;
const channels = this.client.channels.filter(c => c.guild.id !== msg.guild.id && c.type === 'text');
const channels = this.client.channels.filter(c => c.type === 'text' && c.guild.id !== msg.guild.id);
const channel = parseTopic(channels, 'portal', this.client.user).random();
if (!channel) return msg.say('Aww... No channel has an open portal...');
try {
+3 -1
View File
@@ -35,9 +35,11 @@ module.exports = class SteamCommand extends Command {
const price = current === original ? `$${current}` : `~~$${original}~~ $${current}`;
const embed = new MessageEmbed()
.setColor(0x101D2F)
.setAuthor(`Steam - ${body.items[0].name}`, 'https://i.imgur.com/vL8b4D5.png')
.setAuthor('Steam', 'https://i.imgur.com/vL8b4D5.png')
.setURL(`http://store.steampowered.com/app/${body.items[0].id}`)
.setImage(body.items[0].tiny_image)
.addField(' Title',
body.items[0].name)
.addField(' Price',
price, true)
.addField(' Metascore',
+50
View File
@@ -0,0 +1,50 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const moment = require('moment');
module.exports = class VocaloidCommand extends Command {
constructor(client) {
super(client, {
name: 'vocaloid',
aliases: ['vocadb'],
group: 'search',
memberName: 'vocaloid',
description: 'Searches VocaDB for your query.',
args: [
{
key: 'query',
prompt: 'What song would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, args) {
const { query } = args;
const { body } = await snekfetch
.get('http://vocadb.net/api/songs')
.query({
query,
maxResults: 1,
getTotalCount: true,
sort: 'FavoritedTimes',
preferAccurateMatches: true,
nameMatchMode: 'Exact'
});
if (!body.totalCount) return msg.say('No Results.');
const embed = new MessageEmbed()
.setAuthor('VocaDB', 'https://i.imgur.com/MklQqa2.png')
.setURL(`http://vocadb.net/S/${body.items[0].id}`)
.addField(' Title',
body.items[0].name)
.addField(' Artist',
body.items[0].artistString)
.addField(' Publish Date',
moment(body.items[0].publishDate).format('MMMM Do YYYY'), true)
.addField(' Length',
(body.items[0].lengthSeconds / 60).toFixed(2).replace(/\./g, ':'), true);
return msg.embed(embed);
}
};