This commit is contained in:
Christian Rendina 2020-05-05 18:07:20 +02:00
parent a2b305895d
commit ab307774ad
1 changed files with 16 additions and 16 deletions

View File

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