From 71c96914193b19da5b152c7f2d11a22c85639d54 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sun, 13 Aug 2017 01:33:56 +0000 Subject: [PATCH] Change to process.env --- README.md | 1 - Shard.js | 4 +- XiaoBot.js | 12 ++--- commands/games/hangman.js | 4 +- commands/search/anime.js | 4 +- commands/search/bot-info.js | 4 +- commands/search/define.js | 4 +- commands/search/giphy.js | 4 +- commands/search/manga.js | 4 +- commands/search/map.js | 4 +- commands/search/osu.js | 4 +- commands/search/soundcloud.js | 4 +- commands/search/wattpad.js | 4 +- commands/search/youtube.js | 4 +- commands/text-edit/translate.js | 4 +- commands/text-edit/webhook.js | 6 +-- commands/util/upvote.js | 4 +- html/carbondesc.html | 25 ----------- html/carbonfeat.html | 75 ------------------------------- html/carbonuse.html | 22 --------- html/discordbots.html | 80 --------------------------------- package.json | 9 ++-- structures/Util.js | 8 ++-- 23 files changed, 46 insertions(+), 248 deletions(-) delete mode 100644 html/carbondesc.html delete mode 100644 html/carbonfeat.html delete mode 100644 html/carbonuse.html delete mode 100644 html/discordbots.html diff --git a/README.md b/README.md index 2aff3c97..9749cb6e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # XiaoBot [![Discord](https://discordapp.com/api/guilds/252317073814978561/embed.png)](https://discord.gg/fqQF8mc) -[![Codacy](https://api.codacy.com/project/badge/Grade/2be44c0fadf64597b4e07f95d0f6a8ef)](https://www.codacy.com/app/dragonfire535/xiaobot) Public Source Code for the Discord Bot XiaoBot, a Discord bot coded in JavaScript with [discord.js](https://github.com/hydrabolt/discord.js) using the diff --git a/Shard.js b/Shard.js index 5c6a2e9c..17add350 100644 --- a/Shard.js +++ b/Shard.js @@ -1,5 +1,5 @@ const { ShardingManager } = require('discord.js'); const path = require('path'); -const { token } = require('./config'); -const manager = new ShardingManager(path.join(__dirname, 'XiaoBot.js'), { token }); +const { TOKEN } = process.env; +const manager = new ShardingManager(path.join(__dirname, 'XiaoBot.js'), { token: TOKEN }); manager.spawn(undefined, 1000); diff --git a/XiaoBot.js b/XiaoBot.js index 28fcc947..30e89f86 100644 --- a/XiaoBot.js +++ b/XiaoBot.js @@ -1,10 +1,10 @@ -const { token, owner, prefix, invite } = require('./config'); +const { TOKEN, OWNER, PREFIX, INVITE } = process.env; const path = require('path'); const { CommandoClient } = require('discord.js-commando'); const client = new CommandoClient({ - commandPrefix: prefix, - owner, - invite, + commandPrefix: PREFIX, + owner: OWNER, + invite: INVITE, disableEveryone: true, unknownCommandResponse: false, disabledEvents: [ @@ -46,7 +46,7 @@ client.registry client.on('ready', () => { console.log(`[READY] Shard ${client.shard.id} Logged in as ${client.user.tag} (${client.user.id})!`); - client.user.setGame(`${prefix}help | Shard ${client.shard.id}`); + client.user.setGame(`${PREFIX}help | Shard ${client.shard.id}`); }); client.on('disconnect', event => { @@ -112,6 +112,6 @@ client.on('guildDelete', async guild => { client.setTimeout(() => process.exit(0), 7200000); -client.login(token); +client.login(TOKEN); process.on('unhandledRejection', console.error); diff --git a/commands/games/hangman.js b/commands/games/hangman.js index 2d3ac382..e0c51b1f 100644 --- a/commands/games/hangman.js +++ b/commands/games/hangman.js @@ -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; diff --git a/commands/search/anime.js b/commands/search/anime.js index 4f5c25ea..a2771afd 100644 --- a/commands/search/anime.js +++ b/commands/search/anime.js @@ -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)); diff --git a/commands/search/bot-info.js b/commands/search/bot-info.js index 74529fbf..75b23abf 100644 --- a/commands/search/bot-info.js +++ b/commands/search/bot-info.js @@ -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') diff --git a/commands/search/define.js b/commands/search/define.js index 909f990e..1ac7af85 100644 --- a/commands/search/define.js +++ b/commands/search/define.js @@ -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() diff --git a/commands/search/giphy.js b/commands/search/giphy.js index cb4b79e2..8cd6866f 100644 --- a/commands/search/giphy.js +++ b/commands/search/giphy.js @@ -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.'); diff --git a/commands/search/manga.js b/commands/search/manga.js index c42a2c23..8a86fa8d 100644 --- a/commands/search/manga.js +++ b/commands/search/manga.js @@ -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)); diff --git a/commands/search/map.js b/commands/search/map.js index a38a8d3b..2962de5a 100644 --- a/commands/search/map.js +++ b/commands/search/map.js @@ -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' }] }); } diff --git a/commands/search/osu.js b/commands/search/osu.js index eff3c20c..2df48c75 100644 --- a/commands/search/osu.js +++ b/commands/search/osu.js @@ -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' }); diff --git a/commands/search/soundcloud.js b/commands/search/soundcloud.js index d6fb5281..de24fad0 100644 --- a/commands/search/soundcloud.js +++ b/commands/search/soundcloud.js @@ -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() diff --git a/commands/search/wattpad.js b/commands/search/wattpad.js index 769ed03b..5b8e6a95 100644 --- a/commands/search/wattpad.js +++ b/commands/search/wattpad.js @@ -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) diff --git a/commands/search/youtube.js b/commands/search/youtube.js index 35223af5..c3996456 100644 --- a/commands/search/youtube.js +++ b/commands/search/youtube.js @@ -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() diff --git a/commands/text-edit/translate.js b/commands/text-edit/translate.js index 296efdfb..7456471a 100644 --- a/commands/text-edit/translate.js +++ b/commands/text-edit/translate.js @@ -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 }); diff --git a/commands/text-edit/webhook.js b/commands/text-edit/webhook.js index 8f1115e3..9c69f9d3 100644 --- a/commands/text-edit/webhook.js +++ b/commands/text-edit/webhook.js @@ -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; } diff --git a/commands/util/upvote.js b/commands/util/upvote.js index 5f356ed3..094675f3 100644 --- a/commands/util/upvote.js +++ b/commands/util/upvote.js @@ -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')); diff --git a/html/carbondesc.html b/html/carbondesc.html deleted file mode 100644 index 3afac129..00000000 --- a/html/carbondesc.html +++ /dev/null @@ -1,25 +0,0 @@ -
- - - XiaoBot, your personal server companion... - -
- Discord Server - -
-

-
- Moderation, Site Searching, Soundboard, Avatar Editing, Games, and more! -
-
diff --git a/html/carbonfeat.html b/html/carbonfeat.html deleted file mode 100644 index 1cacfb68..00000000 --- a/html/carbonfeat.html +++ /dev/null @@ -1,75 +0,0 @@ -
- -
-

Features

-
    -
  1. Avatar image Editing, including Bob Ross, RIP, Wanted, Triggered, Steam Card, and more!
  2. -
  3. Profile Trading Cards, with random rarity!
  4. -
  5. Battle! Challenge your friends or the AI in real turn-based matches!
  6. -
  7. Fun Games including Hangman, Lottery, Math, Quiz, Rock Paper Scissors, Slots, and Typing!
  8. -
  9. Server, User, and Role Information!
  10. -
  11. Minecraft Achievement Generation!
  12. -
  13. Meme Generation!
  14. -
  15. Pokémon Fusion!
  16. -
  17. Moderation Commands including Ban/Kick/Softban/Unban/Warn, Lockdown, and Prune, with Logging!
  18. -
  19. Currency and Temperature Conversion!
  20. -
  21. Math Calculator!
  22. -
  23. Tons of Secret Easter Eggs to discover!
  24. -
  25. Horoscopes!
  26. -
  27. LMGTFY Link Generation!
  28. -
  29. Strawpoll Generation!
  30. -
  31. Events that Happened today in history!
  32. -
  33. Would you rather questions!
  34. -
  35. Random Cats, Dogs, and Xiao Pai Images!
  36. -
  37. 8 Ball, Choose, Coin Flip, Magic Conch, Roll, and Member Roulette!
  38. -
  39. Waifu and Ship Rating!
  40. -
  41. Random Compliments, Chuck Norris Jokes, Quotes, Fact Core Quotes, Fortunes, Names, and Roasts!
  42. -
  43. Roleplay Commands!
  44. -
  45. Search Various sites including:
  46. -
      -
    1. My Anime List
    2. -
    3. Discord Bots
    4. -
    5. Bulbapedia
    6. -
    7. Danbooru
    8. -
    9. Wordnik
    10. -
    11. Yahoo Weather
    12. -
    13. Gelbooru
    14. -
    15. Giphy
    16. -
    17. Konachan
    18. -
    19. Google Maps
    20. -
    21. Neopets
    22. -
    23. NPM
    24. -
    25. osu!
    26. -
    27. Pokédex
    28. -
    29. Recipe Puppy
    30. -
    31. Reddit
    32. -
    33. Rule34
    34. -
    35. SoundCloud
    36. -
    37. Steam
    38. -
    39. Urban Dictionary
    40. -
    41. VocaDB
    42. -
    43. Wattpad
    44. -
    45. Wikia (Any Wiki)
    46. -
    47. Wikipedia
    48. -
    49. YouTube
    50. -
    51. Yu-Gi-Oh!
    52. -
    -
  47. Random, Daily, and Specific XKCD Comics!
  48. -
  49. Translate Text to almost 100 languages!
  50. -
  51. Binary, Morse, Pirate, and Temmie Translators!
  52. -
  53. Cowsay, Embed, Reverse, Upside Down, and Zalgo Text!
  54. -
  55. Member Join/Leave Logging (with Customization)!
  56. -
  57. Invite Protection!
  58. -
  59. And so so so much more!
  60. -
-
-
diff --git a/html/carbonuse.html b/html/carbonuse.html deleted file mode 100644 index 24d2b35e..00000000 --- a/html/carbonuse.html +++ /dev/null @@ -1,22 +0,0 @@ -
- -
-

Notes

-
    -
  1. Moderation commands require a channel with <modlog> in the topic to send Ban/Kick/Softban/Unban/Warn logs.
  2. -
  3. To use member join/leave logging, place <memberlog> in the channel topic. Custom messages can be set with <joinmessage>messagegoeshere</joinmessage> and <leavemessage>messagegoeshere</leavemessage>
  4. -
  5. To use invite guard, place <inviteguard> in the default channel topic.
  6. -
  7. Use x;help to view a command list
  8. -
  9. Visit my home server for more support, or for updates, or if you just want to hang out.
  10. -
-
-
diff --git a/html/discordbots.html b/html/discordbots.html deleted file mode 100644 index 536b5e65..00000000 --- a/html/discordbots.html +++ /dev/null @@ -1,80 +0,0 @@ -
- - XiaoBot, your personal server companion... - -

-
-

Source Code

- Discord Server -
-

Features

-
    -
  1. Avatar image Editing, including Bob Ross, RIP, Wanted, Triggered, Steam Card, and more!
  2. -
  3. Profile Trading Cards, with random rarity!
  4. -
  5. Battle! Challenge your friends or the AI in real turn-based matches!
  6. -
  7. Fun Games including Hangman, Lottery, Math, Quiz, Rock Paper Scissors, Slots, and Typing!
  8. -
  9. Server, User, and Role Information!
  10. -
  11. Minecraft Achievement Generation!
  12. -
  13. Meme Generation!
  14. -
  15. Pokémon Fusion!
  16. -
  17. Moderation Commands including Ban/Kick/Softban/Unban/Warn, Lockdown, and Prune, with Logging!
  18. -
  19. Currency and Temperature Conversion!
  20. -
  21. Math Calculator!
  22. -
  23. Tons of Secret Easter Eggs to discover!
  24. -
  25. Horoscopes!
  26. -
  27. LMGTFY Link Generation!
  28. -
  29. Strawpoll Generation!
  30. -
  31. Events that Happened today in history!
  32. -
  33. Would you rather questions!
  34. -
  35. Random Cats, Dogs, VOCALOID Songs, and Xiao Pai Images!
  36. -
  37. 8 Ball, Choose, Coin Flip, Magic Conch, Roll, and Member Roulette!
  38. -
  39. Waifu and Ship Rating!
  40. -
  41. Random Compliments, Chuck Norris Jokes, Quotes, Fact Core Quotes, Fortunes, Names, and Roasts!
  42. -
  43. Roleplay Commands!
  44. -
  45. Search Various sites including:
  46. -
      -
    1. My Anime List
    2. -
    3. Discord Bots
    4. -
    5. Bulbapedia
    6. -
    7. Danbooru
    8. -
    9. Wordnik
    10. -
    11. Yahoo Weather
    12. -
    13. Gelbooru
    14. -
    15. Giphy
    16. -
    17. Konachan
    18. -
    19. Google Maps
    20. -
    21. Neopets
    22. -
    23. NPM
    24. -
    25. osu!
    26. -
    27. Pokédex
    28. -
    29. Recipe Puppy
    30. -
    31. Reddit
    32. -
    33. Rule34
    34. -
    35. SoundCloud
    36. -
    37. Steam
    38. -
    39. Urban Dictionary
    40. -
    41. VocaDB
    42. -
    43. Wattpad
    44. -
    45. Wikia (Any Wiki)
    46. -
    47. Wikipedia
    48. -
    49. YouTube
    50. -
    51. Yu-Gi-Oh!
    52. -
    -
  47. Random, Daily, and Specific XKCD Comics!
  48. -
  49. Translate Text to almost 100 languages!
  50. -
  51. Binary, Morse, Pirate, and Temmie Translators!
  52. -
  53. Cowsay, Embed, Reverse, Upside Down, and Zalgo Text!
  54. -
  55. Member Join/Leave Logging (with Customization)!
  56. -
  57. Invite Protection!
  58. -
  59. And so so so much more!
  60. - -
-

Notes

-
    -
  1. Moderation commands require a channel with <modlog> in the topic to send Ban/Kick/Softban/Unban/Warn logs.
  2. -
  3. To use member join/leave logging, place <memberlog> in the channel topic. Custom messages can be set with <joinmessage>messagegoeshere</joinmessage> and <leavemessage>messagegoeshere</leavemessage>
  4. -
  5. To use invite guard, place <inviteguard> in the default channel topic.
  6. -
  7. Use x;help to view a command list
  8. -
  9. Visit my home server for more support, or for updates, or if you just want to hang out.
  10. -
-
diff --git a/package.json b/package.json index 5637383b..d9bff9d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "29.2.0", + "version": "30.0.0", "description": "Your personal server companion.", "main": "Shard.js", "scripts": { @@ -36,7 +36,7 @@ "discord.js": "github:hydrabolt/discord.js", "discord.js-commando": "github:gawdl3y/discord.js-commando", "erlpack": "github:hammerandchisel/erlpack", - "mathjs": "^3.16.0", + "mathjs": "^3.16.1", "moment": "^2.18.1", "moment-duration-format": "^1.3.0", "snekfetch": "^3.2.9", @@ -46,7 +46,7 @@ "zalgolize": "^1.2.4" }, "devDependencies": { - "eslint": "^4.4.0", + "eslint": "^4.4.1", "eslint-config-aqua": "^1.4.1" }, "eslintConfig": { @@ -55,7 +55,8 @@ "camelcase": "off", "id-length": "off", "no-await-in-loop": "off", - "no-console": "off" + "no-console": "off", + "no-process-env": "off" } } } diff --git a/structures/Util.js b/structures/Util.js index eca71729..85059a01 100644 --- a/structures/Util.js +++ b/structures/Util.js @@ -1,5 +1,5 @@ const snekfetch = require('snekfetch'); -const { carbonKey, dbotsKey, dbotsOrgKey } = require('../config'); +const { CARBON_KEY, DBOTS_KEY, DBOTSORG_KEY } = process.env; class Util { static cleanXML(str) { @@ -15,7 +15,7 @@ class Util { static dBots(count, id) { snekfetch .post(`https://bots.discord.pw/api/bots/${id}/stats`) - .set({ Authorization: dbotsKey }) + .set({ Authorization: DBOTS_KEY }) .send({ server_count: count }) .then(() => console.log('[DBOTS] Successfully posted to Discord Bots.')) .catch(err => console.error(`[DBOTS] Failed to post to Discord Bots. ${err}`)); @@ -25,7 +25,7 @@ class Util { snekfetch .post('https://www.carbonitex.net/discord/data/botdata.php') .send({ - key: carbonKey, + key: CARBON_KEY, servercount: count }) .then(() => console.log('[CARBON] Successfully posted to Carbon.')) @@ -35,7 +35,7 @@ class Util { static dBotsOrg(count, id) { snekfetch .post(`https://discordbots.org/api/bots/${id}/stats`) - .set({ Authorization: dbotsOrgKey }) + .set({ Authorization: DBOTSORG_KEY }) .send({ server_count: count }) .then(() => console.log('[DBOTSORG] Successfully posted to Discord Bots Org.')) .catch(err => console.error(`[DBOTSORG] Failed to post to Discord Bots Org. ${err}`));