Skip to content
Snippets Groups Projects
Commit 249980a7 authored by Reviath's avatar Reviath
Browse files

Update commands/steam.js

parent b85e7ffa
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,11 @@ const Discord = require('discord.js') ...@@ -2,7 +2,11 @@ const Discord = require('discord.js')
var steam = require('steam-provider') var steam = require('steam-provider')
var provider = new steam.SteamProvider(); var provider = new steam.SteamProvider();
exports.run = (client, message, args) => { exports.run = (client, message, args, connection) => {
let guildid = message.guild.id;
var sql = `SELECT dil FROM guilds WHERE guildid='${guildid}'`;
connection.query(sql, function (err, result) {
if(result == "tr"){
let game = args.slice(1).join(' '); let game = args.slice(1).join(' ');
let steampng = "https://cdn.discordapp.com/attachments/458004691402489856/470344660364034049/steam.png" let steampng = "https://cdn.discordapp.com/attachments/458004691402489856/470344660364034049/steam.png"
if (!game) return message.reply('Lütfen Steamde Olan Bir Oyunun Adını Yazın. Örnek: `*steam ets2`') if (!game) return message.reply('Lütfen Steamde Olan Bir Oyunun Adını Yazın. Örnek: `*steam ets2`')
...@@ -28,6 +32,34 @@ exports.run = (client, message, args) => { ...@@ -28,6 +32,34 @@ exports.run = (client, message, args) => {
}); });
}) })
}) })
} else {
let game = args.slice(1).join(' ');
let steampng = "https://cdn.discordapp.com/attachments/458004691402489856/470344660364034049/steam.png"
if (!game) return message.reply('Lütfen Steamde Olan Bir Oyunun Adını Yazın. Örnek: `*steam ets2`')
provider.search(game).then(result => {
if(!result) return message.channel.send('Oyun bulunamadı!')
provider.detail(result[0].id, "turkey", "tr").then(results => {
const embed = new Discord.MessageEmbed()
.setAuthor('Steam Store', steampng)
.setTitle(result[0].name)
.addField(`Game's ID`, result[0].id)
.setThumbnail(results.otherData.imageUrl)
.addField('Genres', results.genres)
.addField('Price', `${results.priceData.initialPrice} TL`, true)
.addField('Platorms', results.otherData.platforms, true)
.addField('Metacritic Score', results.otherData.metacriticScore, true)
.addField('Features', results.otherData.features, true)
.addField('Developer', results.otherData.developer, true)
.addField('Publishers', results.otherData.publisher)
.setColor('RANDOM')
.setFooter('Steam Market')
message.channel.send(embed).catch(e => {
client.channels.cache.get('790640302452375562').send(`Error on steam command \n${e}`)
});
})
})
}
});
} }
module.exports.help = { module.exports.help = {
name: 'steam', name: 'steam',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment