feat: use environment vars to store keys

This commit is contained in:
2021-07-27 22:25:17 -04:00
parent 111f5bb9ab
commit f16707c43a
2 changed files with 4 additions and 4 deletions

1
Procfile Normal file
View File

@@ -0,0 +1 @@
web: python main.py

View File

@@ -1,8 +1,7 @@
import discord
import requests
import json
LUNAR_CRUSH_API_KEY = "LUNAR_API_KEY"
import os
client = discord.Client()
@@ -27,7 +26,7 @@ async def on_message(message):
symbols = ["BTC", "ETH", "LTC"]
# make the call for prices
http_response = requests.get("https://api.lunarcrush.com/v2?data=assets&key=" + LUNAR_CRUSH_API_KEY + "&symbol=" + ",".join(symbols))
http_response = requests.get("https://api.lunarcrush.com/v2?data=assets&key=" + os.getenv("LUNAR_CRUSH_API_KEY") + "&symbol=" + ",".join(symbols))
data = json.loads(http_response.text)
# extract prices
@@ -43,4 +42,4 @@ async def on_message(message):
await message.channel.send(msg_response)
client.run("DISCORD_TOKEN") # pass the bot token here
client.run(os.getenv("DISCORD_BOT_TOKEN")) # pass the bot token here