forked from HonusBot/HonusBot
Arves merda non era finit0
This commit is contained in:
parent
ab307774ad
commit
824a8dfa81
17
inline.py
17
inline.py
@ -116,7 +116,6 @@ class Config:
|
|||||||
return self.userAgent
|
return self.userAgent
|
||||||
|
|
||||||
def jsonasResponse(dct):
|
def jsonasResponse(dct):
|
||||||
print("LOG:::",str(dct))
|
|
||||||
if "imageUrl" in dct:
|
if "imageUrl" in dct:
|
||||||
return JSONResponse(dct["authorized"], dct["success"], dct["imageUrl"], "")
|
return JSONResponse(dct["authorized"], dct["success"], dct["imageUrl"], "")
|
||||||
elif "htmlDescription" in dct:
|
elif "htmlDescription" in dct:
|
||||||
@ -145,7 +144,7 @@ class InlineBot:
|
|||||||
self.commands.append(Command("Yiff", "Yiff", "imageurl", "imageUrl"))
|
self.commands.append(Command("Yiff", "Yiff", "imageurl", "imageUrl"))
|
||||||
self.commands.append(Command("Lewd", "Say hi to the police", "imageurl", "imageUrl"))
|
self.commands.append(Command("Lewd", "Say hi to the police", "imageurl", "imageUrl"))
|
||||||
self.commands.append(Command("Rasoio", "Dai facciamogli lo scherzo del rasoio!1!!", "genericurl", "htmlDescription"))
|
self.commands.append(Command("Rasoio", "Dai facciamogli lo scherzo del rasoio!1!!", "genericurl", "htmlDescription"))
|
||||||
self.cancerCommand = Command("Cancer", "Search cancer", "imageurl", "imageurl")
|
self.cancerCommand = Command("Cancer", "Search cancer", "imageurl", "imageUrl")
|
||||||
|
|
||||||
def callRequest(self, command, senderid, text = ""):
|
def callRequest(self, command, senderid, text = ""):
|
||||||
if not command:
|
if not command:
|
||||||
@ -172,13 +171,7 @@ class InlineBot:
|
|||||||
self.logger.warning('Unathorized/Unsuccessfull')
|
self.logger.warning('Unathorized/Unsuccessfull')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
txt = r.headers[command.getHeaderField()]
|
return resp
|
||||||
|
|
||||||
if len(txt) < 1:
|
|
||||||
self.logger.warning('Wrong response in header:',command.getHeaderField())
|
|
||||||
return None ## Wrong api?
|
|
||||||
|
|
||||||
return txt
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.prequest = Request(con_pool_size=int(self.config.getBotConnectionPool()))
|
self.prequest = Request(con_pool_size=int(self.config.getBotConnectionPool()))
|
||||||
@ -204,7 +197,7 @@ class InlineBot:
|
|||||||
|
|
||||||
def errorHandler(self, update, context):
|
def errorHandler(self, update, context):
|
||||||
"""Log Errors caused by Updates."""
|
"""Log Errors caused by Updates."""
|
||||||
self.logger.warning('Update "%s" caused error "%s"', update, context.error)
|
self.logger.error('Update "%s" caused error "%s"', update, context.error)
|
||||||
|
|
||||||
def commandStart(self, update, context):
|
def commandStart(self, update, context):
|
||||||
context.bot.send_message(chat_id=update.effective_chat.id, text="Inline cancer, clop, furry spammer (h0nus)",parse_mode="HTML")
|
context.bot.send_message(chat_id=update.effective_chat.id, text="Inline cancer, clop, furry spammer (h0nus)",parse_mode="HTML")
|
||||||
@ -232,9 +225,9 @@ class InlineBot:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if command.getMode() == "imageurl":
|
if command.getMode() == "imageurl":
|
||||||
contentText = InputTextMessageContent("<a href=\"" + qValue + "\">HonusBot</a>", "HTML")
|
contentText = InputTextMessageContent("<a href=\"" + resp.getImageUrl() + "\">HonusBot</a>", "HTML")
|
||||||
elif command.getMode() == "genericurl":
|
elif command.getMode() == "genericurl":
|
||||||
contentText = InputTextMessageContent("<a href=\"" + qValue + "\">link</a>", "HTML")
|
contentText = InputTextMessageContent("<a href=\"" + resp.getHtmlDesc() + "\">link</a>", "HTML")
|
||||||
else:
|
else:
|
||||||
contentText = InputTextMessageContent("Error", "HTML")
|
contentText = InputTextMessageContent("Error", "HTML")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user