From 4c5f12de8f48f6b884a017d4b56df6e61650fb4f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 1 Apr 2020 19:04:39 +0000 Subject: [PATCH] add covid --- network.py | 3 ++- trifling.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/network.py b/network.py index b855b25..b7934da 100644 --- a/network.py +++ b/network.py @@ -5,7 +5,8 @@ import re # networkurl = "http://node.marty.cf:18019/getinfo" # networkurl = "http://node.xmrbackb.one:18081/getinfo" # networkurl = "http://opennode.minemonero.pro:18081/getinfo" -networkurl = "http://node.xmr.pt:18081/getinfo" +# networkurl = "http://node.xmr.pt:18081/getinfo" +networkurl = "http://node.supportxmr.com:18081/getinfo" @sopel.module.commands('fork', 'forkening') def fork(bot, trigger): diff --git a/trifling.py b/trifling.py index e432da8..f9a8c9a 100644 --- a/trifling.py +++ b/trifling.py @@ -155,6 +155,41 @@ def collect(bot, trigger): bot.say('{0} price: ${1:,.2f}, and {2} price: ${3:,.3f}'.format(item.capitalize(), value_of_one_item, coin.capitalize(), coin_price)) bot.say('{0}: collect {1} per day to exchange for {2:,.5f} {3} each week!'.format(item.capitalize(), quantity, weekly_coins_to_buy, coin)) +@sopel.module.commands('covid', 'corona', 'conv') +def covid(bot, trigger): + if not trigger.group(2): + try: + r = requests.get( + 'https://corona.lmao.ninja/all') + j = r.json() + cases = j['cases'] + deaths = j['deaths'] + recovered = j['recovered'] + active = j['active'] + affectedCountries = j['affectedCountries'] + bot.say("Total Cases : {0} || Total Deaths : {1} || Recovered Cases : {2} || Active Cases : {3} || Affected Countries : {4} ".format( + cases, deaths, recovered, active, affectedCountries)) + except: + bot.say("API fucked up :(") + else: + try: + countryname = trigger.group(2) + r = requests.get( + 'https://corona.lmao.ninja/countries/{0}'.format(countryname)) + j = r.json() + country = j['country'] + cases = j['cases'] + todayCases = j['todayCases'] + deaths = j['deaths'] + todayDeaths = j['todayDeaths'] + recovered = j['recovered'] + active = j['active'] + critical = j['critical'] + bot.say("Country : {0} || Total Cases : {1} || Today Cases : {2} || Total Deaths : {3} || Today Deaths : {4} || Recovered Cases : {5} || Active Cases : {6} || Cricital Cases : {7} ".format( + country, cases, todayCases, deaths, todayDeaths, recovered, active, critical)) + except: + bot.say("API fucked up :(") + @sopel.module.commands('cryptosid', 'sid') def cryptosid(bot, trigger): bot.say('https://img.huffingtonpost.com/asset/58acbbd0280000d59899a57a.jpeg?ops=crop_5_33_460_393,scalefit_720_noupscale')