From ad17cef133f259a39686c90e448716516e267fc5 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sun, 30 Jul 2017 21:50:20 +0000 Subject: [PATCH] Vocaloid Upgrade, Steam Change, Fix Portal --- assets/json/vocaloid.json | 42 --------------------------- commands/random-res/vocaloid.js | 18 ------------ commands/random/portal-send.js | 2 +- commands/search/steam.js | 4 ++- commands/search/vocaloid.js | 50 +++++++++++++++++++++++++++++++++ html/carbonfeat.html | 3 +- html/discordbots.html | 1 + package.json | 2 +- 8 files changed, 58 insertions(+), 64 deletions(-) delete mode 100644 assets/json/vocaloid.json delete mode 100644 commands/random-res/vocaloid.js create mode 100644 commands/search/vocaloid.js diff --git a/assets/json/vocaloid.json b/assets/json/vocaloid.json deleted file mode 100644 index 48fcccea..00000000 --- a/assets/json/vocaloid.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - "https://www.youtube.com/watch?v=ebAKoRcYFTA", - "https://www.youtube.com/watch?v=Mqps4anhz0Q", - "https://www.youtube.com/watch?v=AUEiHQOCQ2M", - "https://www.youtube.com/watch?v=oyteTOBxRm8", - "https://www.youtube.com/watch?v=uwwU55zBYlQ", - "https://www.youtube.com/watch?v=sSYoz0JmnZo", - "https://www.youtube.com/watch?v=NpU4dsXW6EI", - "https://www.youtube.com/watch?v=MzyXD8bNbvk", - "https://www.youtube.com/watch?v=hyV4qGAPKac", - "https://www.youtube.com/watch?v=pywNi6gD1FA", - "https://www.youtube.com/watch?v=17FEtaiWdVg", - "https://www.youtube.com/watch?v=fmrA-gxJxgQ", - "https://www.youtube.com/watch?v=yOBWgSPrYVA", - "https://www.youtube.com/watch?v=nCaqf9WhqOY", - "https://www.youtube.com/watch?v=cQKGUgOfD8U", - "https://www.youtube.com/watch?v=sK92X82T3Sk", - "https://www.youtube.com/watch?v=AH5_sKwDw1E", - "https://www.youtube.com/watch?v=dw-KJNqcK-Q", - "https://www.youtube.com/watch?v=X47JmmqbMvc", - "https://www.youtube.com/watch?v=ojQPpYVQt7U", - "https://www.youtube.com/watch?v=N1-Z8uslIsI", - "https://www.youtube.com/watch?v=EAgk-t2zzqw", - "https://www.youtube.com/watch?v=uLBC2kWYFo8", - "https://www.youtube.com/watch?v=OXHYIlkZLUU", - "https://www.youtube.com/watch?v=ObIa9wXbyMQ", - "https://www.youtube.com/watch?v=dGNoCICGmo0", - "https://www.youtube.com/watch?v=LcoyEZkTKfY", - "https://www.youtube.com/watch?v=mKHaW0qd5Mw", - "https://www.youtube.com/watch?v=GG627DYk_E4", - "https://www.youtube.com/watch?v=jTm6Q5Pj_Jo", - "https://www.youtube.com/watch?v=TVeIDmk3rBo", - "https://www.youtube.com/watch?v=1K3in6w9tt4", - "https://www.youtube.com/watch?v=07r67gGbtLQ", - "https://www.youtube.com/watch?v=243vPl8HdVk", - "https://www.youtube.com/watch?v=zweVJrnE1uY", - "https://www.youtube.com/watch?v=RKtoreimcQ8", - "https://www.youtube.com/watch?v=Je6dCVfHvkU", - "https://www.youtube.com/watch?v=UxFv12y_evM", - "https://www.youtube.com/watch?v=2HegQtmJeto", - "https://www.youtube.com/watch?v=8-Epnpruww0" -] diff --git a/commands/random-res/vocaloid.js b/commands/random-res/vocaloid.js deleted file mode 100644 index 4b36d41c..00000000 --- a/commands/random-res/vocaloid.js +++ /dev/null @@ -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); - } -}; diff --git a/commands/random/portal-send.js b/commands/random/portal-send.js index 17501ce0..39cc9121 100644 --- a/commands/random/portal-send.js +++ b/commands/random/portal-send.js @@ -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 { diff --git a/commands/search/steam.js b/commands/search/steam.js index 569c1c00..c8950af0 100644 --- a/commands/search/steam.js +++ b/commands/search/steam.js @@ -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', diff --git a/commands/search/vocaloid.js b/commands/search/vocaloid.js new file mode 100644 index 00000000..700d379e --- /dev/null +++ b/commands/search/vocaloid.js @@ -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); + } +}; diff --git a/html/carbonfeat.html b/html/carbonfeat.html index d1ad3c4f..1cacfb68 100644 --- a/html/carbonfeat.html +++ b/html/carbonfeat.html @@ -29,7 +29,7 @@
  • Strawpoll Generation!
  • Events that Happened today in history!
  • Would you rather questions!
  • -
  • Random Cats, Dogs, VOCALOID Songs, and Xiao Pai Images!
  • +
  • Random Cats, Dogs, and Xiao Pai Images!
  • 8 Ball, Choose, Coin Flip, Magic Conch, Roll, and Member Roulette!
  • Waifu and Ship Rating!
  • Random Compliments, Chuck Norris Jokes, Quotes, Fact Core Quotes, Fortunes, Names, and Roasts!
  • @@ -56,6 +56,7 @@
  • SoundCloud
  • Steam
  • Urban Dictionary
  • +
  • VocaDB
  • Wattpad
  • Wikia (Any Wiki)
  • Wikipedia
  • diff --git a/html/discordbots.html b/html/discordbots.html index a2e2ebc0..536b5e65 100644 --- a/html/discordbots.html +++ b/html/discordbots.html @@ -53,6 +53,7 @@
  • SoundCloud
  • Steam
  • Urban Dictionary
  • +
  • VocaDB
  • Wattpad
  • Wikia (Any Wiki)
  • Wikipedia
  • diff --git a/package.json b/package.json index fa366c33..2de1a2b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "28.1.1", + "version": "28.2.0", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {