From 317b1d6399e2f91abc86dc91653051952873b915 Mon Sep 17 00:00:00 2001 From: dgw Date: Sat, 2 Jan 2016 07:32:36 -0600 Subject: [PATCH] [currency] Make arguments case-insensitive (close #979) --- sopel/modules/currency.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sopel/modules/currency.py b/sopel/modules/currency.py index e1ed1f5f88..6debdf737d 100644 --- a/sopel/modules/currency.py +++ b/sopel/modules/currency.py @@ -26,9 +26,10 @@ def get_rate(code): - if code.upper() == 'CAD': + code = code.upper() + if code == 'CAD': return 1, 'Canadian Dollar' - elif code.upper() == 'BTC': + elif code == 'BTC': rates = json.loads(web.get('https://api.bitcoinaverage.com/ticker/all')) return 1 / rates['CAD']['24h_avg'], 'Bitcoin—24hr average' @@ -85,8 +86,8 @@ def display(bot, amount, of, to): return NOLIMIT result = amount / of_rate * to_rate - bot.say("{} {} ({}) = {} {} ({})".format(amount, of, of_name, - result, to, to_name)) + bot.say("{} {} ({}) = {} {} ({})".format(amount, of.upper(), of_name, + result, to.upper(), to_name)) @commands('btc', 'bitcoin')