Covid.py
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"
})
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