|
|
|
@ -6,8 +6,8 @@ name='Reisub-Bot -> Friendicarg'
|
|
|
|
|
|
|
|
|
|
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 😉',
|
|
|
|
@ -50,11 +50,12 @@ def log_friend(update: Update, context: CallbackContext) -> 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('><i class=icon-link icon-large><span class=sr-only',''))
|
|
|
|
|
else:
|
|
|
|
|
update.message.reply_text(return_string('not_l_f',lang))
|
|
|
|
|