diff --git a/README.md b/README.md
index 66ae1c6..b708d28 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,9 @@
-# telefricabot
+#Telefricabot
Es un proyecto hecho en python para utilizar telegram
como cliente de friendica, nacio desde la idea de un
bot para controlar las funciones de reisub.nsupdate.info
y entre esas estaba friendica, decidimos hacerlo publico
-con la licencia GPL v3 para que otras instancias se lo
+con la licencia GPL v3 para que otras instancias se lo
montaran en su pc o movil y tuviesen un bot propio sin
anuncios y sin saber programar.
-
-
diff --git a/api.py b/api.py
index d851d1b..a330365 100644
--- a/api.py
+++ b/api.py
@@ -1,3 +1,4 @@
+
import requests,io,random,re
ua = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101'
@@ -38,4 +39,18 @@ class FriendApi():
else:
out=out+'\n'+'\n'+i.replace(re.findall('">',i)[0],' ').replace('','').replace('','')
return out
-
+ def network(self,limit):
+ texto=self.session.get('https://friendicarg.nsupdate.info/network').text
+ exp=re.findall('
.*
',texto)
+ exp1=re.findall('"display/.*"',texto)
+ out=[]
+ for i in re.findall('',texto):
+ texto=texto.replace(i,'')
+ for i in re.findall('',texto):
+ texto.replace(i,'')
+ for i in range(0,limit):
+ try:
+ out.append(exp[i].replace('','').replace('','').replace('','').replace('
','')+'\n'+self.url+exp1[i].replace('"','').replace('> None:
except:
lang="es"
bot.send_chat_action(chat_id=update.message.chat_id, action=telegram.ChatAction.TYPING)
+ print(context.args)
if len(context.args)<=1:
update.message.reply_text(return_string('log_s_f',lang))
else:
try:
- friend=api.FriendApi(friendica_u,context.args[0],context.args[1])
+ friend=api.FriendApi("https://friendicarg.nsupdate.info/",context.args[0],context.args[1])
crud.connect("friend_users.db")
if len(crud.read("users","telegram",update.message.chat_id))==0:
crud.create("users","'"+str(update.message.chat_id)+"','"+context.args[0]+"','"+context.args[1]+"'")
@@ -90,12 +91,14 @@ def publish(update: Update, context: CallbackContext) -> None:
except:
lang="es"
bot.send_chat_action(chat_id=update.message.chat_id, action=telegram.ChatAction.TYPING)
+ print(lang)
crud.connect("friend_users.db")
r=crud.read("users","telegram",update.message.chat_id)
if len(r)==1:
try:
if '-' in str(update.message.chat_id):
- friend=api.FriendApi(friendica_u,r[0][1],r[0][2])
+ print('LOGGING DEBUG: RUNNING IN A GROUP, if this work please remove the line 93 of the code')
+ friend=api.FriendApi("https://friendicarg.nsupdate.info/",r[0][1],r[0][2])
contexto=update.message.text
rex=re.findall("#!.*!#",contexto)
if rex:
@@ -123,7 +126,7 @@ def publish(update: Update, context: CallbackContext) -> None:
update.message.reply_text(rex+'\n'+contexto.replace('/publish@reisub_bot','').replace('/publish ','').replace('#!'+rex+'!#',''))
context.bot.delete_message(chat_id = update.message.chat_id, message_id = update.message.message_id)
else:
- friend=api.FriendApi(friendica_u,r[0][1],r[0][2])
+ friend=api.FriendApi("https://friendicarg.nsupdate.info/",r[0][1],r[0][2])
contexto=update.message.text
rex=re.findall("#!.*!#",contexto)
if rex:
@@ -164,8 +167,24 @@ def notifications(update:Update,context:CallbackContext):
crud.connect("friend_users.db")
r=crud.read("users","telegram",update.message.chat_id)
if len(r)==1:
- friend=api.FriendApi(friendica_u,r[0][1],r[0][2])
+ friend=api.FriendApi("https://friendicarg.nsupdate.info/",r[0][1],r[0][2])
update.message.reply_text(friend.notifications(5))
else:
update.message.reply_text(return_string('not_l_f',lang))
+def get_5(update:Update,context:CallbackContext):
+ try:
+ lan=io.open(update.effective_user.username,"r")
+ lang=lan.read()
+ lan.close()
+ except:
+ lang="es"
+ bot.send_chat_action(chat_id=update.message.chat_id, action=telegram.ChatAction.TYPING)
+ crud.connect("friend_users.db")
+ r=crud.read("users","telegram",update.message.chat_id)
+ if len(r)==1:
+ friend=api.FriendApi("https://friendicarg.nsupdate.info/",r[0][1],r[0][2])
+ for i in range(0,4):
+ update.message.reply_text(friend.network(5)[i].replace('>