Browse Source

Ajout de la commande Bitcoin

master
Geekcat 1 year ago
parent
commit
34b3fbf0f4
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      cogs/text.py

+ 9
- 0
cogs/text.py View File

@@ -73,6 +73,15 @@ class text:
katology = "Tu connais katology ? Un blog francais traitant de l'actualité technologique, avec un aspect communautaire !\n http://katolo.gy !"
await self.bot.say(katology)

@client.command()
async def bitcoin():
url = 'https://api.coindesk.com/v1/bpi/currentprice/BTC.json'
async with aiohttp.ClientSession() as session: # Async HTTP request
raw_response = await session.get(url)
response = await raw_response.text()
response = json.loads(response)
await client.say("Bitcoin price is: " + response['bpi']['EUR']['rate'] + " €")


def setup(bot):
bot.add_cog(text(bot))