This commit is contained in:
Christian Rendina 2020-05-05 18:07:20 +02:00
parent a2b305895d
commit ab307774ad

View File

@ -117,10 +117,10 @@ class Config:
def jsonasResponse(dct):
print("LOG:::",str(dct))
if "imageurl" in dct:
return JSONResponse(dct["authorized"], dct["success"], dct["imageurl"], "")
elif "htmldescription" in dct:
return JSONResponse(dct["authorized"], dct["success"], "", dct["htmldescription"])
if "imageUrl" in dct:
return JSONResponse(dct["authorized"], dct["success"], dct["imageUrl"], "")
elif "htmlDescription" in dct:
return JSONResponse(dct["authorized"], dct["success"], "", dct["htmlDescription"])
else:
raise Exception("Invalid JSON")
@ -138,13 +138,13 @@ class InlineBot:
self.config.read("config.ini")
def __makeCommands(self):
self.commands.append(Command("Pony", "yay, ponies!", "imageurl", "imageurl"))
self.commands.append(Command("Clop", "NSFW ponies", "imageurl", "imageurl"))
self.commands.append(Command("Furry", "Furries", "imageurl", "imageurl"))
self.commands.append(Command("Loli", "Cute lolis", "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("Rasoio", "Dai facciamogli lo scherzo del rasoio!1!!", "genericurl", "htmldescription"))
self.commands.append(Command("Pony", "yay, ponies!", "imageurl", "imageUrl"))
self.commands.append(Command("Clop", "NSFW ponies", "imageurl", "imageUrl"))
self.commands.append(Command("Furry", "Furries", "imageurl", "imageUrl"))
self.commands.append(Command("Loli", "Cute lolis", "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("Rasoio", "Dai facciamogli lo scherzo del rasoio!1!!", "genericurl", "htmlDescription"))
self.cancerCommand = Command("Cancer", "Search cancer", "imageurl", "imageurl")
def callRequest(self, command, senderid, text = ""):
@ -162,11 +162,11 @@ class InlineBot:
return None
resp = None
try:
resp = json.loads(r.text, object_hook = jsonasResponse)
except:
self.logger.warning('JSON deserialization failed')
return None ## Invalid json
#try:
resp = json.loads(r.text, object_hook = jsonasResponse)
#except:
# self.logger.warning('JSON deserialization failed')
# return None ## Invalid json
if not resp.isAuthorized() or not resp.succeeded():
self.logger.warning('Unathorized/Unsuccessfull')