The Power of const

This commit is contained in:
Daniel Odendahl Jr
2017-04-03 22:31:19 +00:00
parent 4f0f1b4ad2
commit 76907549df
87 changed files with 525 additions and 558 deletions
+4 -4
View File
@@ -27,9 +27,9 @@ module.exports = class AppStoreCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let query = args.query;
const query = args.query;
try {
let response = await request
const response = await request
.get('https://itunes.apple.com/search')
.query({
term: query,
@@ -37,8 +37,8 @@ module.exports = class AppStoreCommand extends commando.Command {
entity: 'software',
limit: 1
});
let parsedResponse = JSON.parse(response.text);
let data = parsedResponse.results[0];
const parsedResponse = JSON.parse(response.text);
const data = parsedResponse.results[0];
const embed = new Discord.RichEmbed()
.setColor(0x1BA3F7)
.setAuthor('App Store', 'https://upload.wikimedia.org/wikipedia/en/1/1f/App_Store_Logo.png')
+3 -3
View File
@@ -28,14 +28,14 @@ module.exports = class BotSearchCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let botToFind = args.bot.id;
const botToFind = args.bot.id;
try {
let response = await request
const response = await request
.get(`https://bots.discord.pw/api/bots/${botToFind}`)
.set({
'Authorization': config.botskey
});
let data = response.body;
const data = response.body;
const embed = new Discord.RichEmbed()
.setColor(0x9797FF)
.setAuthor('Discord Bots', 'https://cdn.discordapp.com/icons/110373943822540800/47336ad0631ac7aac0a48a2ba6246c65.jpg')
+3 -3
View File
@@ -30,9 +30,9 @@ module.exports = class DefineCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let defineThis = encodeURI(args.word);
const defineThis = encodeURI(args.word);
try {
let response = await request
const response = await request
.get(`http://api.wordnik.com:80/v4/word.json/${defineThis}/definitions`)
.query({
limit: 1,
@@ -41,7 +41,7 @@ module.exports = class DefineCommand extends commando.Command {
includeTags: false,
api_key: config.wordnikkey
});
let data = response.body[0];
const data = response.body[0];
const embed = new Discord.RichEmbed()
.setColor(0x9797FF)
.setTitle(data.word)
+2 -2
View File
@@ -32,8 +32,8 @@ module.exports = class DiscrimCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let userToSearch = args.discrim;
let users = await this.client.users.filter(u => u.discriminator === userToSearch).map(u => u.username).sort();
const userToSearch = args.discrim;
const users = await this.client.users.filter(u => u.discriminator === userToSearch).map(u => u.username).sort();
const embed = new Discord.RichEmbed()
.setTitle(`${users.length} Users with the discriminator: ${userToSearch}`)
.setDescription(users.join(', '));
+4 -4
View File
@@ -26,16 +26,16 @@ module.exports = class ForecastCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let locationToSearch = args.locationQ;
const locationToSearch = args.locationQ;
try {
let response = await request
const response = await request
.get('https://query.yahooapis.com/v1/public/yql')
.query({
q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${locationToSearch}")`,
format: 'json'
});
let info = response.body.query.results.channel;
let data = info.item.forecast;
const info = response.body.query.results.channel;
const data = info.item.forecast;
const embed = new Discord.RichEmbed()
.setColor(0x0000FF)
.setAuthor(info.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png')
+3 -3
View File
@@ -27,10 +27,10 @@ module.exports = class GoogleCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let thingToSearch = args.query;
let searchMsg = await message.say('Searching...');
const thingToSearch = args.query;
const searchMsg = await message.say('Searching...');
try {
let response = await request
const response = await request
.get(`https://www.google.com/search`)
.query({
q: thingToSearch
+3 -3
View File
@@ -28,15 +28,15 @@ module.exports = class IMDBCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let queryMovie = args.movie;
const queryMovie = args.movie;
try {
let response = await request
const response = await request
.get(`http://www.omdbapi.com/`)
.query({
t: queryMovie,
plot: 'full'
});
let data = response.body;
const data = response.body;
const embed = new Discord.RichEmbed()
.setColor(0xDBA628)
.setAuthor('IMDB', 'http://static.wixstatic.com/media/c65cbf_31901b544fe24f1890134553bf40c8be.png')
+1 -1
View File
@@ -21,7 +21,7 @@ module.exports = class NeopetCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return;
}
console.log(`[Command] ${message.content}`);
let petID = args.pet;
const petID = args.pet;
return message.say(`http://pets.neopets.com/cp/${petID}/1/5.png`);
}
};
+3 -3
View File
@@ -29,16 +29,16 @@ module.exports = class OsuCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let usernameToSearch = args.username;
const usernameToSearch = args.username;
try {
let response = await request
const response = await request
.get('https://osu.ppy.sh/api/get_user')
.query({
k: config.osukey,
u: usernameToSearch,
type: 'string'
});
let data = response.body[0];
const data = response.body[0];
const embed = new Discord.RichEmbed()
.setColor(0xFF66AA)
.setAuthor('osu!', 'http://vignette3.wikia.nocookie.net/osugame/images/c/c9/Logo.png/revision/latest?cb=20151219073209')
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class PokedexCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let pokemon = args.pokemon.toLowerCase();
const pokemon = args.pokemon.toLowerCase();
const embed = new Discord.RichEmbed()
.setTitle('Information')
.setAuthor(`#${pokedex.index[pokemon]} ${pokedex.name[pokemon]}`, `http://www.serebii.net/pokedex-sm/icon/${pokedex.index[pokemon]}.png`)
+3 -3
View File
@@ -28,14 +28,14 @@ module.exports = class UrbanDictionary extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let wordToDefine = args.word;
const wordToDefine = args.word;
try {
let response = await request
const response = await request
.get('http://api.urbandictionary.com/v0/define')
.query({
term: wordToDefine
});
let data = response.body.list[0];
const data = response.body.list[0];
const embed = new Discord.RichEmbed()
.setColor(0x32a8f0)
.setAuthor('Urban Dictionary', 'http://a1.mzstatic.com/eu/r30/Purple71/v4/66/54/68/6654683f-cacd-4a55-1784-f14257f77874/icon175x175.png')
+3 -3
View File
@@ -24,9 +24,9 @@ module.exports = class WattpadCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let queryBook = args.book;
const queryBook = args.book;
try {
let response = await request
const response = await request
.get('https://api.wattpad.com:443/v4/stories')
.set({
'Authorization': `Basic ${config.wattpadkey}`
@@ -35,7 +35,7 @@ module.exports = class WattpadCommand extends commando.Command {
query: queryBook,
limit: 1
});
let data = response.body.stories[0];
const data = response.body.stories[0];
const embed = new Discord.RichEmbed()
.setColor(0xF89C34)
.setAuthor('Wattpad', 'http://www.selfpubtoolbox.com/wp-content/uploads/2015/05/a6044fd3a88acd5043860484db972ca6.png')
+3 -3
View File
@@ -23,15 +23,15 @@ module.exports = class WeatherCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let locationToSearch = args.locationQ;
const locationToSearch = args.locationQ;
try {
let response = await request
const response = await request
.get('https://query.yahooapis.com/v1/public/yql')
.query({
q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${locationToSearch}")`,
format: 'json'
});
let data = response.body.query.results.channel;
const data = response.body.query.results.channel;
const embed = new Discord.RichEmbed()
.setColor(0x0000FF)
.setAuthor(data.title, 'http://media.idownloadblog.com/wp-content/uploads/2013/12/yahoo-weather-213x220.png')
+5 -6
View File
@@ -23,11 +23,10 @@ module.exports = class WikipediaCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let thingToSearch = args.query;
thingToSearch = thingToSearch.split(")").join("%29");
let title = encodeURI(thingToSearch);
const thingToSearch = args.query.split(")").join("%29");
const title = encodeURI(thingToSearch);
try {
let response = await request
const response = await request
.get(`https://en.wikipedia.org/w/api.php`)
.query({
action: 'query',
@@ -39,8 +38,8 @@ module.exports = class WikipediaCommand extends commando.Command {
redirects: '',
formatversion: 2
});
let data = response.body.query.pages[0];
let description = data.extract.substr(0, 1900).split('\n').join('\n\n');
const data = response.body.query.pages[0];
const description = data.extract.substr(0, 1900).split('\n').join('\n\n');
const embed = new Discord.RichEmbed()
.setColor(0xE7E7E7)
.setTitle(data.title)
+3 -3
View File
@@ -27,9 +27,9 @@ module.exports = class YouTubeCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let videoToSearch = args.video;
const videoToSearch = args.video;
try {
let response = await request
const response = await request
.get('https://www.googleapis.com/youtube/v3/search')
.query({
part: 'snippet',
@@ -38,7 +38,7 @@ module.exports = class YouTubeCommand extends commando.Command {
q: videoToSearch,
key: config.youtubekey
});
let data = response.body.items[0];
const data = response.body.items[0];
const embed = new Discord.RichEmbed()
.setColor(0xDD2825)
.setTitle(data.snippet.title)
+3 -3
View File
@@ -23,11 +23,11 @@ module.exports = class YuGiOhCommand extends commando.Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let cardName = encodeURI(args.card);
const cardName = encodeURI(args.card);
try {
let response = await request
const response = await request
.get(`http://yugiohprices.com/api/card_data/${cardName}`);
let data = response.body.data;
const data = response.body.data;
if (data.card_type === 'monster') {
const embed = new Discord.RichEmbed()
.setColor(0xBE5F1F)