Compare commits

...

3 Commits

Author SHA1 Message Date
b4b4d9797d Merge pull request 'Dodato jos frontova' (#2) from svitvojimilioni/chatbot:libre-rewrite into dev
Reviewed-on: #2
2024-02-09 11:16:03 +00:00
305fc1405a Dodao frontende za vise servisa
- frontendi su u frontends.py fajlu
- ima vise instanci da ne bi stalno slao na jednu, da nema centralizacije ;)
2024-02-07 20:04:59 -05:00
ea6ba7464c Dodao frontende za vise servisa
- frontendi su u frontends.py fajlu
- ima vise instanci da ne bi stalno slao na jednu, da nema centralizacije ;)
2024-02-07 19:57:36 -05:00
2 changed files with 17 additions and 3 deletions

11
frontends.py Normal file
View File

@ -0,0 +1,11 @@
FRONTENDS = {
"youtube.com/watch": ("iv.datura.network", "inv.tux.pizza"),
"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")
}

View File

@ -1,13 +1,16 @@
import ollama import ollama
import scraper_functions as sf import scraper_functions as sf
import random
from frontends import FRONTENDS
def processmsg(msg, rcpt): def processmsg(msg, rcpt):
if "youtube.com/watch" in msg: if msg.startswith("!"):
return msg.replace("youtube.com", "iv.datura.network")
elif msg.startswith("!"):
return command(msg, "") return command(msg, "")
elif "good bot" in msg: elif "good bot" in msg:
return "^_^" 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): def command(msg, rcpt):
if msg.startswith("!help"): if msg.startswith("!help"):