feat: use environment vars to store keys
This commit is contained in:
7
main.py
7
main.py
@@ -1,8 +1,7 @@
|
|||||||
import discord
|
import discord
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
LUNAR_CRUSH_API_KEY = "LUNAR_API_KEY"
|
|
||||||
|
|
||||||
client = discord.Client()
|
client = discord.Client()
|
||||||
|
|
||||||
@@ -27,7 +26,7 @@ async def on_message(message):
|
|||||||
symbols = ["BTC", "ETH", "LTC"]
|
symbols = ["BTC", "ETH", "LTC"]
|
||||||
|
|
||||||
# make the call for prices
|
# 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)
|
data = json.loads(http_response.text)
|
||||||
|
|
||||||
# extract prices
|
# extract prices
|
||||||
@@ -43,4 +42,4 @@ async def on_message(message):
|
|||||||
|
|
||||||
await message.channel.send(msg_response)
|
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
|
||||||
Reference in New Issue
Block a user