Compare commits
10 Commits
328329eb9a
...
master
Author | SHA1 | Date | |
---|---|---|---|
72c474e97f
|
|||
d52b4ac5e5
|
|||
690239bb86
|
|||
b416e04a9a
|
|||
f2b288fa30
|
|||
145114320c
|
|||
4485d15740 | |||
b4b4d9797d | |||
305fc1405a | |||
ea6ba7464c |
12
frontends.py
Normal file
12
frontends.py
Normal file
@@ -0,0 +1,12 @@
|
||||
FRONTENDS = {
|
||||
"www.youtube.com/watch": ("iv.datura.network/watch", "inv.tux.pizza/watch"),
|
||||
"youtube.com/watch": ("iv.datura.network/watch", "inv.tux.pizza/watch"),
|
||||
"medium.com" : ("scribe.rip", "sc.vern.cc", "m.opnxng.com"),
|
||||
"stackoverflow.com": ("code.whatever.social", "ao.vern.cc", "overflow.smnz.de"),
|
||||
"instagram.com": ("bibliogram.1d4.us", "bibliogram.froth.zone", "ig.opnxng.com", "proxigram.lunar.icu"),
|
||||
"genius.com": ("dm.vern.cc", "dumb.lunar.icu", "dumb.esmailelbob.xyz"),
|
||||
"reddit.com":("eu.safereddit.com", "l.opnxng.com", "libreddit.bus-hit.me"),
|
||||
"www.imdb.com": ("libremdb.iket.me", "ld.vern.cc", "binge.whatever.social"),
|
||||
"twitter.com": ("n.opnxng.com", "nitter.1d4.us", "nitter.adminforge.de"),
|
||||
"wikipedia.com": ("wiki.adminforge.de", "wiki.froth.zone", "wikiless.esmailelbob.xyz")
|
||||
}
|
18
functions.py
18
functions.py
@@ -1,13 +1,16 @@
|
||||
import ollama
|
||||
import scraper_functions as sf
|
||||
import random
|
||||
from frontends import FRONTENDS
|
||||
|
||||
def processmsg(msg, rcpt):
|
||||
if "youtube.com/watch" in msg:
|
||||
return msg.replace("youtube.com", "iv.datura.network")
|
||||
elif msg.startswith("!"):
|
||||
if msg.startswith("!"):
|
||||
return command(msg, "")
|
||||
elif "good bot" in msg:
|
||||
return "^_^"
|
||||
for big_tech_site in FRONTENDS:
|
||||
if big_tech_site in msg:
|
||||
return "libre link: " + msg.replace(big_tech_site, random.choice(FRONTENDS[big_tech_site]))
|
||||
|
||||
def command(msg, rcpt):
|
||||
if msg.startswith("!help"):
|
||||
@@ -29,6 +32,9 @@ def command(msg, rcpt):
|
||||
content = sf.getDmzTasks("https://todo.dmz.rs/")
|
||||
return content
|
||||
elif msg.startswith("!vreme") or msg.startswith("!prognoza") or msg.startswith("!weather"):
|
||||
_, query = msg.split(" ", 1)
|
||||
return sf.get_weather(query)
|
||||
|
||||
commandsplit = msg.split(" ", 1)
|
||||
if len(commandsplit) == 1:
|
||||
return sf.get_weather("Beograd")
|
||||
else:
|
||||
query = commandsplit[1]
|
||||
return sf.get_weather(query)
|
||||
|
@@ -50,8 +50,8 @@ def getDmzTasks(url):
|
||||
return e
|
||||
|
||||
def get_weather(city:str) -> str:
|
||||
url = f"https://wttr.in/{city}?format=3"
|
||||
if not city.isalpha():
|
||||
url = f"https://wttr.in/{city}?format=4"
|
||||
if not city.replace(" ","").isalpha():
|
||||
return "no such city"
|
||||
resp = requests.get(url)
|
||||
return resp.content.decode("utf-8").strip()
|
||||
|
Reference in New Issue
Block a user