mirror of
git://git.acid.vegas/scroll.git
synced 2024-11-07 08:46:45 +00:00
Added error handling for .ascii img command
This commit is contained in:
parent
78ff35d4db
commit
bd048ae332
@ -235,8 +235,12 @@ class Bot():
|
|||||||
elif args[1] == 'img' and len(args) == 3:
|
elif args[1] == 'img' and len(args) == 3:
|
||||||
url = args[2]
|
url = args[2]
|
||||||
if url.startswith('https://') or url.startswith('http://'):
|
if url.startswith('https://') or url.startswith('http://'):
|
||||||
|
try:
|
||||||
content = urllib.request.urlopen(url).read()
|
content = urllib.request.urlopen(url).read()
|
||||||
ascii = await img2irc.convert(content, int(self.settings['png_width']))
|
ascii = await img2irc.convert(content, int(self.settings['png_width']))
|
||||||
|
except Exception as ex:
|
||||||
|
await self.irc_error(chan, 'failed to convert image', ex)
|
||||||
|
else:
|
||||||
if ascii:
|
if ascii:
|
||||||
for line in ascii:
|
for line in ascii:
|
||||||
await self.sendmsg(chan, line)
|
await self.sendmsg(chan, line)
|
||||||
|
Loading…
Reference in New Issue
Block a user