From abed9cf4ea71dcbad2dd2c049683b8d14b942e09 Mon Sep 17 00:00:00 2001 From: dngfx Date: Fri, 31 Aug 2018 10:50:37 +0100 Subject: Reformat --- modules/bitcoin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules/bitcoin.py') 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") -- cgit v1.3.1-10-gc9f91