diff options
| author | 2018-08-31 10:50:37 +0100 | |
|---|---|---|
| committer | 2018-08-31 10:50:37 +0100 | |
| commit | abed9cf4ea71dcbad2dd2c049683b8d14b942e09 (patch) | |
| tree | 3e40caf63fa7e1500469f4ad9a0c45c51808aad4 /modules/bitcoin.py | |
| parent | Fix a copy paste fail in IRCLineHandler that caused PARTs to be handled as QUITs (diff) | |
| signature | ||
Reformat
Diffstat (limited to 'modules/bitcoin.py')
| -rw-r--r-- | modules/bitcoin.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/bitcoin.py b/modules/bitcoin.py index 17408322..6686e1e8 100644 --- a/modules/bitcoin.py +++ b/modules/bitcoin.py @@ -1,7 +1,9 @@ import Utils + class Module(object): _name = "BTC" + def __init__(self, bot): self.bot = bot bot.events.on("received").on("command").on("btc").hook( @@ -11,15 +13,16 @@ class Module(object): def btc(self, event): currency = (event["args"] or "USD").upper() page = Utils.get_url("https://blockchain.info/ticker", - json=True) + json=True) if page: if currency in page: conversion = page[currency] buy, sell = conversion["buy"], conversion["sell"] event["stdout"].write("1 BTC = %.2f %s (buy) %.2f %s " - "(sell)" % (buy, currency, sell, currency)) + "(sell)" % ( + buy, currency, sell, currency)) else: event["stderr"].write("Unknown currency, available " - "currencies: %s" % ", ".join(page.keys())) + "currencies: %s" % ", ".join(page.keys())) else: event["stderr"].write("Failed to load results") |
