Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

Covid.py #33

Open
wants to merge 1 commit into
base: sql-extended
Choose a base branch
from
Open

Covid.py #33

wants to merge 1 commit into from

Conversation

FLAEIGN
Copy link

@FLAEIGN FLAEIGN commented Sep 5, 2020

from covid import Covid
from userbot import CMD_HELP
from userbot.events import register

@register(outgoing=True, pattern="^.coronavirus(?: |$)(.*)")
async def corona(event):
covid = Covid()
data = covid.get_data()
country = event.pattern_match.group(1)
country_data = get_country_data(country, data)
output_text = ""
for name, value in country_data.items():
output_text += "{}: {}\n".format(str(name), str(value))
await event.edit("CoronaVirus Info in {}:\n\n{}".format(country.capitalize(), output_text))

def get_country_data(country, world):
for country_data in world:
if country_data["country"] == country:
return country_data
return {"Status": "No information yet about this country!"}

CMD_HELP.update({
"covid":
".coronavirus
\nUsage: Get an information about data covid-19 in your country.\n"
})

from covid import Covid
from userbot import CMD_HELP
from userbot.events import register

@register(outgoing=True, pattern="^.coronavirus(?: |$)(.*)")
async def corona(event):
    covid = Covid()
    data = covid.get_data()
    country = event.pattern_match.group(1)
    country_data = get_country_data(country, data)
    output_text = "" 
    for name, value in country_data.items():
        output_text += "`{}`: `{}`\n".format(str(name), str(value))
    await event.edit("**CoronaVirus Info in {}**:\n\n{}".format(country.capitalize(), output_text))

def get_country_data(country, world):
    for country_data in world:
        if country_data["country"] == country:
            return country_data
    return {"Status": "No information yet about this country!"}
    
    
CMD_HELP.update({
        "covid": 
        ".coronavirus <country>\
          \nUsage: Get an information about data covid-19 in your country.\n"
    })
@justTheKai
Copy link
Contributor

Seriously
We already have this,. And you wanna add again? Mean 1 not enough for you?

https://github.com/MoveAngel/One4uBot/blob/sql-extended/userbot/modules/covid.py

@MoveAngel MoveAngel force-pushed the sql-extended branch 2 times, most recently from fa84b2a to c9701da Compare December 9, 2020 07:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants