mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Steam Command
This commit is contained in:
@@ -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}`);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
@@ -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>
|
||||
|
||||
@@ -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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "28.0.2",
|
||||
"version": "28.1.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user