mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-22 15:26:37 +00:00
IrcMiRCARTBot.py:_dispatchPrivmsg(): print message from website if upload fails.
IrcMiRCARTBot.py:_uploadToImgur(): additionally return responseHttp.text on failure.
This commit is contained in:
parent
8d6f6ef56e
commit
8b483e262e
@ -163,7 +163,9 @@ class IrcMiRCARTBot(IrcClient.IrcClient):
|
|||||||
self.clientLastMessage = int(time.time())
|
self.clientLastMessage = int(time.time())
|
||||||
else:
|
else:
|
||||||
self._log("Upload failed with HTTP status code {}".format(imgurResponse[0]))
|
self._log("Upload failed with HTTP status code {}".format(imgurResponse[0]))
|
||||||
|
self._log("Message from website: {}".format(imgurResponse[1]))
|
||||||
self.queue("PRIVMSG", message[2], "4/!\\ Upload failed with HTTP status code {}!".format(imgurResponse[0]))
|
self.queue("PRIVMSG", message[2], "4/!\\ Upload failed with HTTP status code {}!".format(imgurResponse[0]))
|
||||||
|
self.queue("PRIVMSG", message[2], "4/!\\ Message from website: {}".format(imgurResponse[1]))
|
||||||
if os.path.isfile(asciiTmpFilePath):
|
if os.path.isfile(asciiTmpFilePath):
|
||||||
os.remove(asciiTmpFilePath)
|
os.remove(asciiTmpFilePath)
|
||||||
if os.path.isfile(imgTmpFilePath):
|
if os.path.isfile(imgTmpFilePath):
|
||||||
@ -197,7 +199,7 @@ class IrcMiRCARTBot(IrcClient.IrcClient):
|
|||||||
if responseHttp.status_code == 200:
|
if responseHttp.status_code == 200:
|
||||||
return [200, responseDict.get("data").get("link")]
|
return [200, responseDict.get("data").get("link")]
|
||||||
else:
|
else:
|
||||||
return [responseHttp.status_code]
|
return [responseHttp.status_code, responseHttp.text]
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ _urlretrieveReportHook(count, blockSize, totalSize): Limit downloads to 1 MB
|
# {{{ _urlretrieveReportHook(count, blockSize, totalSize): Limit downloads to 1 MB
|
||||||
def _urlretrieveReportHook(count, blockSize, totalSize):
|
def _urlretrieveReportHook(count, blockSize, totalSize):
|
||||||
|
Loading…
Reference in New Issue
Block a user