Change to process.env

This commit is contained in:
Daniel Odendahl Jr
2017-08-13 01:33:56 +00:00
parent e75251b3f9
commit 71c9691419
23 changed files with 46 additions and 248 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command');
const snekfetch = require('snekfetch');
const { stripIndents } = require('common-tags');
const { wordnikKey } = require('../../config');
const { WORDNIK_KEY } = process.env;
module.exports = class HangmanCommand extends Command {
constructor(client) {
@@ -30,7 +30,7 @@ module.exports = class HangmanCommand extends Command {
maxDictionaryCount: -1,
minLength: -1,
maxLength: -1,
api_key: wordnikKey
api_key: WORDNIK_KEY
});
const word = body.word.toLowerCase().replace(/[ ]/g, '-');
let points = 0;
+2 -2
View File
@@ -4,7 +4,7 @@ const snekfetch = require('snekfetch');
const { cleanXML } = require('../../structures/Util');
const { promisifyAll } = require('tsubaki');
const xml = promisifyAll(require('xml2js'));
const { animelistLogin } = require('../../config');
const { ANIMELIST_LOGIN } = process.env;
module.exports = class AnimeCommand extends Command {
constructor(client) {
@@ -28,7 +28,7 @@ module.exports = class AnimeCommand extends Command {
const { query } = args;
try {
const { text } = await snekfetch
.get(`https://${animelistLogin}@myanimelist.net/api/anime/search.xml`)
.get(`https://${ANIMELIST_LOGIN}@myanimelist.net/api/anime/search.xml`)
.query({ q: query });
const { anime } = await xml.parseStringAsync(text);
const synopsis = cleanXML(anime.entry[0].synopsis[0].substr(0, 2048));
+2 -2
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { dbotsKey } = require('../../config');
const { DBOTS_KEY } = process.env;
module.exports = class BotSearchCommand extends Command {
constructor(client) {
@@ -26,7 +26,7 @@ module.exports = class BotSearchCommand extends Command {
try {
const { body } = await snekfetch
.get(`https://bots.discord.pw/api/bots/${bot.id}`)
.set({ Authorization: dbotsKey });
.set({ Authorization: DBOTS_KEY });
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setAuthor('Discord Bots', 'https://i.imgur.com/lrKYBQi.jpg')
+2 -2
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { wordnikKey } = require('../../config');
const { WORDNIK_KEY } = process.env;
module.exports = class DefineCommand extends Command {
constructor(client) {
@@ -30,7 +30,7 @@ module.exports = class DefineCommand extends Command {
limit: 1,
includeRelated: false,
useCanonical: false,
api_key: wordnikKey
api_key: WORDNIK_KEY
});
if (!body.length) return msg.say('No Results.');
const embed = new MessageEmbed()
+2 -2
View File
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const snekfetch = require('snekfetch');
const { giphyKey } = require('../../config');
const { GIPHY_KEY } = process.env;
module.exports = class GiphyCommand extends Command {
constructor(client) {
@@ -25,7 +25,7 @@ module.exports = class GiphyCommand extends Command {
.get('http://api.giphy.com/v1/gifs/search')
.query({
q: query,
api_key: giphyKey,
api_key: GIPHY_KEY,
rating: msg.channel.nsfw ? 'r' : 'pg'
});
if (!body.data.length) return msg.say('No Results.');
+2 -2
View File
@@ -4,7 +4,7 @@ const snekfetch = require('snekfetch');
const { cleanXML } = require('../../structures/Util');
const { promisifyAll } = require('tsubaki');
const xml = promisifyAll(require('xml2js'));
const { animelistLogin } = require('../../config');
const { ANIMELIST_LOGIN } = process.env;
module.exports = class MangaCommand extends Command {
constructor(client) {
@@ -28,7 +28,7 @@ module.exports = class MangaCommand extends Command {
const { query } = args;
try {
const { text } = await snekfetch
.get(`https://${animelistLogin}@myanimelist.net/api/manga/search.xml`)
.get(`https://${ANIMELIST_LOGIN}@myanimelist.net/api/manga/search.xml`)
.query({ q: query });
const { manga } = await xml.parseStringAsync(text);
const synopsis = cleanXML(manga.entry[0].synopsis[0].substr(0, 2048));
+2 -2
View File
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const snekfetch = require('snekfetch');
const { googleKey } = require('../../config');
const { GOOGLE_KEY } = process.env;
module.exports = class MapCommand extends Command {
constructor(client) {
@@ -38,7 +38,7 @@ module.exports = class MapCommand extends Command {
center: query,
zoom,
size: '500x500',
key: googleKey
key: GOOGLE_KEY
});
return msg.say({ files: [{ attachment: body, name: 'map.png' }] });
}
+2 -2
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { osuKey } = require('../../config');
const { OSU_KEY } = process.env;
module.exports = class OsuCommand extends Command {
constructor(client) {
@@ -26,7 +26,7 @@ module.exports = class OsuCommand extends Command {
const { body } = await snekfetch
.get('https://osu.ppy.sh/api/get_user')
.query({
k: osuKey,
k: OSU_KEY,
u: query,
type: 'string'
});
+2 -2
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { soundcloudKey } = require('../../config');
const { SOUNDCLOUD_KEY } = process.env;
module.exports = class SoundCloudCommand extends Command {
constructor(client) {
@@ -27,7 +27,7 @@ module.exports = class SoundCloudCommand extends Command {
.get('https://api.soundcloud.com/tracks')
.query({
q: query,
client_id: soundcloudKey
client_id: SOUNDCLOUD_KEY
});
if (!body.length) return msg.say('No Results.');
const embed = new MessageEmbed()
+2 -2
View File
@@ -2,7 +2,7 @@ const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const moment = require('moment');
const { wattpadKey } = require('../../config');
const { WATTPAD_KEY } = process.env;
module.exports = class WattpadCommand extends Command {
constructor(client) {
@@ -30,7 +30,7 @@ module.exports = class WattpadCommand extends Command {
query,
limit: 1
})
.set({ Authorization: `Basic ${wattpadKey}` });
.set({ Authorization: `Basic ${WATTPAD_KEY}` });
if (!body.stories.length) return msg.say('No Results.');
const embed = new MessageEmbed()
.setColor(0xF89C34)
+2 -2
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { googleKey } = require('../../config');
const { GOOGLE_KEY } = process.env;
module.exports = class YouTubeCommand extends Command {
constructor(client) {
@@ -30,7 +30,7 @@ module.exports = class YouTubeCommand extends Command {
type: 'video',
maxResults: 1,
q: query,
key: googleKey
key: GOOGLE_KEY
});
if (!body.items.length) return msg.say('No Results.');
const embed = new MessageEmbed()
+2 -2
View File
@@ -2,7 +2,7 @@ const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const codes = require('../../assets/json/translate');
const { yandexKey } = require('../../config');
const { YANDEX_KEY } = process.env;
module.exports = class TranslateCommand extends Command {
constructor(client) {
@@ -53,7 +53,7 @@ module.exports = class TranslateCommand extends Command {
const { body } = await snekfetch
.get('https://translate.yandex.net/api/v1.5/tr.json/translate')
.query({
key: yandexKey,
key: YANDEX_KEY,
text,
lang: from ? `${from}-${to}` : to
});
+3 -3
View File
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const snekfetch = require('snekfetch');
const { webhookURL } = require('../../config');
const { WEBHOOK_URL } = process.env;
module.exports = class WebhookCommand extends Command {
constructor(client) {
@@ -9,7 +9,7 @@ module.exports = class WebhookCommand extends Command {
aliases: ['rin', 'rin-say'],
group: 'text-edit',
memberName: 'webhook',
description: 'Posts a message to the webhook defined in your `config.json`.',
description: 'Posts a message to the webhook defined in your `process.env`.',
guildOnly: true,
ownerOnly: true,
clientPermissions: ['MANAGE_MESSAGES'],
@@ -27,7 +27,7 @@ module.exports = class WebhookCommand extends Command {
const { content } = args;
msg.delete();
await snekfetch
.post(webhookURL)
.post(WEBHOOK_URL)
.send({ content });
return null;
}
+2 -2
View File
@@ -1,7 +1,7 @@
const Command = require('../../structures/Command');
const snekfetch = require('snekfetch');
const { stripIndents } = require('common-tags');
const { dbotsOrgKey } = require('../../config');
const { DBOTSORG_KEY } = process.env;
module.exports = class UpvoteCommand extends Command {
constructor(client) {
@@ -18,7 +18,7 @@ module.exports = class UpvoteCommand extends Command {
async run(msg) {
const { body } = await snekfetch
.get(`https://discordbots.org/api/bots/${this.client.user.id}/votes`)
.set({ Authorization: dbotsOrgKey });
.set({ Authorization: DBOTSORG_KEY });
const haste = await snekfetch
.post('https://hastebin.com/documents')
.send(body.map(user => `${user.username}#${user.discriminator}`).join('\n'));