This repository has been archived by the owner on Sep 29, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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"
})