Steam Command

This commit is contained in:
Daniel Odendahl Jr
2017-07-30 02:26:21 +00:00
parent a02d08ffef
commit 48e1775215
5 changed files with 52 additions and 2 deletions
+2 -1
View File
@@ -26,7 +26,8 @@ module.exports = class PortalSendCommand extends Command {
async run(msg, args) {
const { message } = args;
const channel = parseTopic(this.client.channels, 'portal', this.client.user).random();
const channels = this.client.channels.filter(c => 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 {
await channel.send(`**${msg.author.tag} (${msg.guild.name}):** ${message}`);
+47
View File
@@ -0,0 +1,47 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
module.exports = class SteamCommand extends Command {
constructor(client) {
super(client, {
name: 'steam',
group: 'search',
memberName: 'steam',
description: 'Searches Steam for your query.',
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'query',
prompt: 'What game would you like to search for?',
type: 'string'
}
]
});
}
async run(msg, args) {
const { query } = args;
const { body } = await snekfetch
.get('https://store.steampowered.com/api/storesearch')
.query({
cc: 'us',
l: 'en',
term: query
});
if (!body.total) return msg.say('No Results.');
const current = body.items[0].price ? body.items[0].price.final / 100 : 0.00;
const original = body.items[0].price ? body.items[0].price.initial / 100 : 0.00;
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')
.setURL(`http://store.steampowered.com/app/${body.items[0].id}`)
.setImage(body.items[0].tiny_image)
.addField(' Price',
price, true)
.addField(' Metascore',
body.items[0].metascore || 'N/A', true);
return msg.embed(embed);
}
};
+1
View File
@@ -54,6 +54,7 @@
<li>Reddit</li>
<li>Rule34</li>
<li>SoundCloud</li>
<li>Steam</li>
<li>Urban Dictionary</li>
<li>Wattpad</li>
<li>Wikia (Any Wiki)</li>
+1
View File
@@ -51,6 +51,7 @@
<li>Reddit</li>
<li>Rule34</li>
<li>SoundCloud</li>
<li>Steam</li>
<li>Urban Dictionary</li>
<li>Wattpad</li>
<li>Wikia (Any Wiki)</li>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "28.0.2",
"version": "28.1.0",
"description": "Your personal server companion.",
"main": "Shard.js",
"scripts": {