From f16707c43a04143fcb0ba20b690754a37d89efdb Mon Sep 17 00:00:00 2001 From: Giovani Date: Tue, 27 Jul 2021 22:25:17 -0400 Subject: [PATCH] feat: use environment vars to store keys --- Procfile | 1 + main.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..bcf6804 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: python main.py \ No newline at end of file diff --git a/main.py b/main.py index 28db9b2..3a5e1eb 100644 --- a/main.py +++ b/main.py @@ -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 \ No newline at end of file +client.run(os.getenv("DISCORD_BOT_TOKEN")) # pass the bot token here \ No newline at end of file