mirror of
git://git.acid.vegas/scroll.git
synced 2024-11-22 08:06:39 +00:00
Bug fixes
This commit is contained in:
parent
b6f0dcefa5
commit
22940522ba
22
scroll.py
22
scroll.py
@ -92,7 +92,7 @@ class Bot():
|
|||||||
'msg' : 0.03,
|
'msg' : 0.03,
|
||||||
'paste' : True,
|
'paste' : True,
|
||||||
'png_palette' : 'RGB99',
|
'png_palette' : 'RGB99',
|
||||||
'png_quantize_colors' : 99,
|
'png_quantize' : 99,
|
||||||
'png_width' : 80,
|
'png_width' : 80,
|
||||||
'results' : 25}
|
'results' : 25}
|
||||||
self.slow = False
|
self.slow = False
|
||||||
@ -162,20 +162,6 @@ class Bot():
|
|||||||
finally:
|
finally:
|
||||||
self.db = cache
|
self.db = cache
|
||||||
|
|
||||||
try:
|
|
||||||
content = get_url(url).read()
|
|
||||||
except Exception as ex:
|
|
||||||
await self.irc_error(chan, 'failed to convert image', ex)
|
|
||||||
else:
|
|
||||||
if ascii:
|
|
||||||
if len(ascii) <= self.settings['lines']:
|
|
||||||
for line in ascii:
|
|
||||||
await self.sendmsg(chan, line)
|
|
||||||
await asyncio.sleep(self.settings['msg'])
|
|
||||||
else:
|
|
||||||
await self.irc_error('image is too big', 'take it to #scroll')
|
|
||||||
|
|
||||||
|
|
||||||
async def play(self, chan, name, img=False, paste=False):
|
async def play(self, chan, name, img=False, paste=False):
|
||||||
try:
|
try:
|
||||||
if img or paste:
|
if img or paste:
|
||||||
@ -184,7 +170,7 @@ class Bot():
|
|||||||
ascii = get_url(f'https://raw.githubusercontent.com/ircart/ircart/master/ircart/{name}.txt')
|
ascii = get_url(f'https://raw.githubusercontent.com/ircart/ircart/master/ircart/{name}.txt')
|
||||||
if ascii.getcode() == 200:
|
if ascii.getcode() == 200:
|
||||||
if img:
|
if img:
|
||||||
ascii = img2irc.convert(ascii.read(), img, int(self.settings['png_width']), self.settings['png_palette'], int(self.settings['png_quantize_colors']))
|
ascii = img2irc.convert(ascii.read(), img, int(self.settings['png_width']), self.settings['png_palette'], int(self.settings['png_quantize']))
|
||||||
else:
|
else:
|
||||||
ascii = ascii.readlines()
|
ascii = ascii.readlines()
|
||||||
if len(ascii) > int(self.settings['lines']) and chan != '#scroll':
|
if len(ascii) > int(self.settings['lines']) and chan != '#scroll':
|
||||||
@ -325,12 +311,12 @@ class Bot():
|
|||||||
elif args[1] == 'settings':
|
elif args[1] == 'settings':
|
||||||
if len(args) == 2:
|
if len(args) == 2:
|
||||||
for item in self.settings:
|
for item in self.settings:
|
||||||
await self.sendmsg(chan, color(item.ljust(15), yellow) + color(str(self.settings[item]), grey))
|
await self.sendmsg(chan, color(item.ljust(13), yellow) + color(str(self.settings[item]), grey))
|
||||||
elif len(args) == 4 and is_admin(ident):
|
elif len(args) == 4 and is_admin(ident):
|
||||||
setting = args[2]
|
setting = args[2]
|
||||||
option = args[3]
|
option = args[3]
|
||||||
if setting in self.settings:
|
if setting in self.settings:
|
||||||
if setting in ('flood','lines','msg','png_quantize_colors','png_width','results'):
|
if setting in ('flood','lines','msg','png_quantize','png_width','results'):
|
||||||
try:
|
try:
|
||||||
option = float(option)
|
option = float(option)
|
||||||
self.settings[setting] = option
|
self.settings[setting] = option
|
||||||
|
Loading…
Reference in New Issue
Block a user