diff --git a/ifsc.py b/ifsc.py index c52bd27..e83305a 100644 --- a/ifsc.py +++ b/ifsc.py @@ -12,7 +12,7 @@ from main_startup.helper_func.basic_helpers import edit_or_reply, get_text, edit_or_send_as_file, get_user -@friday_on_cmd(['ifsc', 'ifsc_lookup'], +@friday_on_cmd(['ifc', 'ifsc_lookup'], cmd_help={ 'help': 'Get ifsc Code Info.', 'example': '{ch}ifsc SBIN0008658'}) @@ -41,4 +41,4 @@ async def geT_if(client, message): await m_.edit( f"INFORMATION GATHERED SUCCESSFULLY\n\nBank Name : {f}\nBank Address : {a}\nCentre : {b}\nBranch : {c}\nCity : {d}\nState : {e}\nBank Code : {g}\nIFSC : {h}", parse_mode="html", - ) \ No newline at end of file + ) diff --git a/req.txt b/req.txt index a7bbba1..e30998e 100644 --- a/req.txt +++ b/req.txt @@ -1,6 +1,7 @@ wikipedia pytgcalls mal-api +six==1.16.0 git+https://github.com/chsaiujwal/maigret git+https://github.com/gleitz/howdoi speedtest-cli @@ -11,3 +12,4 @@ quotefancy feedparser asyncurban validators>=0.18.2 +xmltodict diff --git a/weather.py b/weather.py new file mode 100644 index 0000000..77388ba --- /dev/null +++ b/weather.py @@ -0,0 +1,39 @@ +import requests +import xmltodict +from main_startup.helper_func.basic_helpers import edit_or_reply, get_text +from bs4 import BeautifulSoup +from pyrogram import filters +from main_startup.core.decorators import friday_on_cmd + + +@friday_on_cmd(['weather','climate','we','cl'], + cmd_help={ + 'help': 'Get Weather info of town or pincode', + 'example': '{ch}we hyderabad'}) +async def geW_if(client, message): + m_ = await edit_or_reply(message, "`Please Wait!`") + city = get_text(message) + data='{"params":"aroundLatLngViaIP=true&hitsPerPage=15&language=en&query='+city+'&type=city"}' + ses=requests.session() + res=ses.post("https://places-dsn.algolia.net/1/places/query",data=data).json() + cords=res["hits"][0]["_geoloc"] + res=ses.get("https://1weather.onelouder.com/feeds/onelouder2/fm.php?LAT="+str(round(cords["lat"],2))+"&LON="+str(round(cords["lng"],2))+"&UNITS=all") + data=xmltodict.parse(res.text) + flag=True + msg="" + try: + msg+="INFORMATION GATHERED SUCCESSFULLY\n\n" + today=data["locations"]["location"] + msg+=("city: "+today["@city"]+" ("+today["@country"]+")"+"\n") + details=today["sfc_ob"] + msg+=("temperature: "+details["temp_C"]+" c"+"\n") + msg+=("apparent temp: "+details["apparent_temp_C"]+" c"+"\n") + msg+=("Weather report: "+details["wx"]+"\n") + msg+=("Wind Speed: "+str(details["wnd_spd_kph"])+"kmph ("+str(details["wnd_dir"])+")"+"\n") + msg+=("Humidity: "+details["rh_pct"]+" %"+"\n") + flag=False + except Exception: + pass + if flag: + return await m_.edit("Information not found") + return await m_.edit(msg)