TextArt: maxLength config for text to figlets

This commit is contained in:
oddluck 2020-03-18 02:21:52 +00:00
parent 3ee4f502ec
commit 7226e2c377
2 changed files with 24 additions and 15 deletions

View File

@ -90,5 +90,8 @@ registry.Integer(99, _("""Set the default foreground color for ascii art images.
conf.registerChannelValue(TextArt, 'bg', conf.registerChannelValue(TextArt, 'bg',
registry.Integer(99, _("""Set the default background color for ascii art images. 0-98. 99 is disabled (default)"""))) registry.Integer(99, _("""Set the default background color for ascii art images. 0-98. 99 is disabled (default)""")))
conf.registerChannelValue(TextArt, 'maxLength',
registry.Integer(20, _("""Set the maximum character length for text to figlet inputs""")))
conf.registerGlobalValue(TextArt, 'userAgents', conf.registerGlobalValue(TextArt, 'userAgents',
registry.CommaSeparatedListOfStrings(["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0"], _("""Reported user agent when fetching links"""))) registry.CommaSeparatedListOfStrings(["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0"], _("""Reported user agent when fetching links""")))

View File

@ -417,6 +417,8 @@ class TextArt(callbacks.Plugin):
if not channel: if not channel:
channel = msg.args[0] channel = msg.args[0]
channel = msg.args[0] channel = msg.args[0]
if len(text) > self.registryValue('maxLength', msg.channel):
return
optlist = dict(optlist) optlist = dict(optlist)
font = None font = None
words = [] words = []
@ -1012,6 +1014,8 @@ class TextArt(callbacks.Plugin):
if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'):
irc.errorNoCapability('admin') irc.errorNoCapability('admin')
return return
if len(text) > self.registryValue('maxLength', msg.channel):
return
optlist = dict(optlist) optlist = dict(optlist)
opts = '' opts = ''
if 'f' in optlist: if 'f' in optlist:
@ -1070,6 +1074,8 @@ class TextArt(callbacks.Plugin):
if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'): if channel != msg.args[0] and not ircdb.checkCapability(msg.prefix, 'admin'):
irc.errorNoCapability('admin') irc.errorNoCapability('admin')
return return
if len(text) > self.registryValue('maxLength', msg.channel):
return
optlist = dict(optlist) optlist = dict(optlist)
opts = '' opts = ''
if 'f' in optlist: if 'f' in optlist: