Security Update 2

unstable
Boris Daniel Martinez Millán 2 years ago
parent 9970729ade
commit b86e1710e3
  1. 10
      bot.py
  2. 4
      friendica_module.py

@ -19,7 +19,7 @@ import requests,io,random,re,api,crud,datetime,time,telegram
from os import remove
#Funcion base, no eliminar
def typing(chat):
bot.send_chat_action(chat_id=chat, action=telegram.ChatAction.TYPING)
context.bot.send_chat_action(chat_id=chat, action=telegram.ChatAction.TYPING)
ua = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101'
ua += ' Firefox/60.0'
@ -107,11 +107,9 @@ try:
except:
pass
bot=Bot(token)
def start(update:Update, context: CallbackContext) -> None:
"""Inicia el Bot"""
typing(update.message.chat_id)
context.bot.send_chat_action(chat_id=update.message.chat_id, action=telegram.ChatAction.TYPING)
try:
lan=io.open(update.effective_user.username,"r")
lang=lan.read()
@ -125,14 +123,14 @@ def start(update:Update, context: CallbackContext) -> None:
def sugerir(update:Update, context: CallbackContext) -> None:
"""Sugiere que aladan algo o mejoren algo"""
bot.send_chat_action(chat_id=update.message.chat_id, action=telegram.ChatAction.TYPING)
context.bot.send_chat_action(chat_id=update.message.chat_id, action=telegram.ChatAction.TYPING)
try:
lan=io.open(update.effective_user.username,"r")
lang=io.read()
lan.close()
except:
lang="es"
bot.send_message(chat_id=admin_id,text="El personaje: @"+update.effective_user.username+" hizo una sugerencia: "+" ".join(context.args))
context.bot.send_message(chat_id=admin_id,text="El personaje: @"+update.effective_user.username+" hizo una sugerencia: "+" ".join(context.args))
update.reply_text(return_string('finish',))
def help(update:Update, context: CallbackContext) -> None:

@ -66,7 +66,7 @@ def log_friend(update: Update, context: CallbackContext) -> None:
crud.save();crud.close()
except ValueError:
update.message.reply_text(return_string('usu_l_f',lang))
context.context.bot.delete_message(chat_id = update.message.chat_id, message_id = update.message.message_id)
context.bot.delete_message(chat_id = update.message.chat_id, message_id = update.message.message_id)
def logout_friend(update: Update, context: CallbackContext) -> None:
"""Borra la cuenta de tu instancia de friendica"""
@ -127,7 +127,7 @@ def publish(update: Update, context: CallbackContext) -> None:
rex.replace("!hora!",horavar)
friend.share(rex,contexto.replace(rex,'').replace('/publish','')+"\n#telegram")
update.message.reply_text(rex+'\n'+contexto.replace('/publish@reisub_bot','').replace('/publish ','').replace('#!'+rex+'!#',''))
context.context.bot.delete_message(chat_id = update.message.chat_id, message_id = update.message.message_id)
context.bot.delete_message(chat_id = update.message.chat_id, message_id = update.message.message_id)
else:
friend=api.FriendApi("https://friendicarg.nsupdate.info/",r[0][1],r[0][2])
contexto=update.message.text

Loading…
Cancel
Save