+
import requests,io,random,re
ua = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101'
else:
out=out+'\n'+'\n'+i.replace(re.findall('"><img src=".*" aria-hidden="true" class="notif-image">',i)[0],' ').replace('<span class="notif-when">','').replace('</span></a>','')
return out
-
+ def network(self,limit):
+ texto=self.session.get('https://friendicarg.nsupdate.info/network').text
+ exp=re.findall('<div class="wall-item-body e-content p-name">.*</div>',texto)
+ exp1=re.findall('"display/.*"',texto)
+ out=[]
+ for i in re.findall('<a href=".*" class="tag" title=".*">',texto):
+ texto=texto.replace(i,'')
+ for i in re.findall('<img src=".*" alt=".*" title=".*">',texto):
+ texto.replace(i,'')
+ for i in range(0,limit):
+ try:
+ out.append(exp[i].replace('</a>','').replace('</div>','').replace('<div class="wall-item-body e-content p-name">','').replace('<br>','')+'\n'+self.url+exp1[i].replace('"','').replace('><i class=icon-link icon-large><span class=ser-only','')+'\n\n')
+ except:
+ break
+ return out
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update,ReplyMarkup,Bot,user
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, CallbackContext, MessageHandler, Filters, CallbackContext
-from include import friendica_u,token
import api,crud,re,io,telegram
+token="1531348810:AAG_ZWBHHPI4qxjeWvyWOwwy3xPXsN_2KJ0"
bot=Bot(token)
es={'pub':'Publicado con exito 😉',
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]+"'")
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:
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:
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('><i class=icon-link icon-large><span class=sr-only',''))
+ else:
+ update.message.reply_text(return_string('not_l_f',lang))