Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ifsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'})
Expand Down Expand Up @@ -41,4 +41,4 @@ async def geT_if(client, message):
await m_.edit(
f"<b><u>INFORMATION GATHERED SUCCESSFULLY</b></u>\n\n<b>Bank Name :</b> <code>{f}</code>\n<b>Bank Address :</b> <code>{a}</code>\n<b>Centre :</b> <code>{b}</code>\n<b>Branch :</b> <code>{c}</code>\n<b>City :</b> <code>{d}</code>\n<b>State :</b> <code>{e}</code>\n<b>Bank Code :</b> <code>{g}</code>\n<b>IFSC :</b> <code>{h}</code>",
parse_mode="html",
)
)
2 changes: 2 additions & 0 deletions req.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -11,3 +12,4 @@ quotefancy
feedparser
asyncurban
validators>=0.18.2
xmltodict
39 changes: 39 additions & 0 deletions weather.py
Original file line number Diff line number Diff line change
@@ -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+="<b><u>INFORMATION GATHERED SUCCESSFULLY</b></u>\n\n"
today=data["locations"]["location"]
msg+=("<b>city: </b> <code>"+today["@city"]+" ("+today["@country"]+")"+"</code>\n")
details=today["sfc_ob"]
msg+=("<b>temperature: </b><code>"+details["temp_C"]+" c"+"</code>\n")
msg+=("<b>apparent temp: </b><code>"+details["apparent_temp_C"]+" c"+"</code>\n")
msg+=("<b>Weather report: </b><code>"+details["wx"]+"</code>\n")
msg+=("<b>Wind Speed: </b><code>"+str(details["wnd_spd_kph"])+"kmph ("+str(details["wnd_dir"])+")"+"</code>\n")
msg+=("<b>Humidity: <b><code>"+details["rh_pct"]+" %"+"</code>\n")
flag=False
except Exception:
pass
if flag:
return await m_.edit("Information not found")
return await m_.edit(msg)