import requests
from telegram import Update
from telegram.ext import Application, CommandHandler, ContextTypes
BOT_TOKEN = "7997907072:AAEcUopih7hkMY5iHb29DIkDKjMNFOLtE1g"
async def get_covid_stats(country: str) -> str:
try:
url = f"https://disease.sh/v3/covid-19/countries/{country}"
response = requests.get(url, timeout=5)
response.raise_for_status()
data = response.json()
return (
f"🦠 **COVID-19 Stats for {data['country']}**👇🏻\n\n"
f"📊 **Total Cases**: {data['cases']:,}\n"
f"🔥 **Active Cases**: {data['active']:,}\n"
f"💀 **Deaths**: {data['deaths']:,}\n"
f"✅ **Recovered**: {data['recovered']:,}\n"
f"🕒 **Last Updated**: {data['updated'] // 1000}"
)
except requests.exceptions.RequestException:
return "⚠️ Invalid country name.\n Example: `/covid India`"
except KeyError:
return "❌ Error in fetching data.\n Please try again later."
async def covid_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
if not context.args:
await update.message.reply_text("❗ Please specify a country.\n Example: `/covid india`", parse_mode="Markdown")
return
country = " ".join(context.args).strip().lower()
covid_info = await get_covid_stats(country)
await update.message.reply_text(covid_info, parse_mode="Markdown")
def main():
application = Application.builder().token(BOT_TOKEN).build()
application.add_handler(CommandHandler("covid", covid_command))
print("🤖 Bot is running...")
application.run_polling()
if __name__ == "__main__":
main()
𝑪𝑹𝑬𝑫𝑰𝑻- @daddy_chips
🎉4👎2
VISIT API SOURCE CODE GIVEAWAY 🎁🤌
1 MEMBERS WIN 🎁
GIVEAWAY START ▶️
TYPE VOTE ☑️
STARTING : 105 SUBSCRIBERS
ENDING : 250 SUBSCRIBERS
NEED 60% PROOF 🧾
CHANNEL LINK 🖇️
https://t.me/sharecodevn
SEND NAME FAST 🙂
@tanhung11231
👍6🎉6🔥2
Free Code 🇻🇳 pinned «VISIT API SOURCE CODE GIVEAWAY 🎁🤌 1 MEMBERS WIN 🎁 GIVEAWAY START ▶️ TYPE VOTE ☑️ STARTING : 105 SUBSCRIBERS ENDING : 250 SUBSCRIBERS NEED 60% PROOF 🧾 CHANNEL LINK 🖇️ https://t.me/sharecodevn SEND NAME FAST 🙂 @tanhung11231»
Chào mọi người, tình hình là nhóm Tấn Hưng cũ đã bị ban.Nhóm đã gần tới cột mốc 4000 thành viên nhưng đã bị xoá.Vì vậy tôi đã tạo 1 nhóm khác và bắt đầu lại từ con số 0.
Tham gia tại đây
Hi everyone, the situation is that the old Tan Hung group has been banned. The group was close to the 4000 member milestone but was deleted. So I created another group and started from zero.
Join here
https://t.me/checkinfo123
Tham gia tại đây
Hi everyone, the situation is that the old Tan Hung group has been banned. The group was close to the 4000 member milestone but was deleted. So I created another group and started from zero.
Join here
https://t.me/checkinfo123
🔥5👍1
GIVEAWAY ĐÃ KẾT THÚC NGƯỜI CHIẾN THẮNG LÀ "APIHACKERVN"
GIVEAWAY HAS ENDED THE WINNER IS "APIHACKERVN"
GIVEAWAY HAS ENDED THE WINNER IS "APIHACKERVN"
👏7
