This commit is contained in:
Daniel Odendahl Jr
2017-05-12 20:29:36 +00:00
parent 13c0acdb59
commit 34d61f77f9
6 changed files with 16 additions and 2 deletions
+2 -1
View File
@@ -44,7 +44,8 @@ module.exports = class CurrencyCommand extends Command {
const { base, to, amount } = args;
if (base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`);
try {
const { body } = await request.get(`http://api.fixer.io/latest?base=${base}&symbols=${to}`);
const { body } = await request
.get(`http://api.fixer.io/latest?base=${base}&symbols=${to}`);
const rate = body.rates[to];
return msg.say(`${amount} ${base} is ${amount * rate} ${to}.`);
} catch (err) {