FML: add an option to hide verbose info (ID, categories, link)

This commit is contained in:
James Lu 2018-05-03 12:18:42 -07:00
parent ca3b9323e7
commit b010141dd5
2 changed files with 8 additions and 5 deletions

View File

@ -49,9 +49,8 @@ def configure(advanced):
FML = conf.registerPlugin('FML')
# This is where your configuration variables (if any) should go. For example:
# conf.registerGlobalValue(FML, 'someConfigVariableName',
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
conf.registerChannelValue(FML, 'showInfo',
registry.Boolean(True, _("""Weather we should show more info (ID, category, and URL) in FML posts.""")))
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:

View File

@ -80,8 +80,12 @@ class FML(callbacks.Plugin):
votes = ircutils.bold("[Agreed: %s / Deserved: %s]" %
(tree.find('agree').text,
tree.find('deserved').text))
s = format('\x02#%i [%s]\x02: %s - %s %u', fmlid,
category, text, votes, url)
if not self.registryValue("showInfo", msg.args[0]):
s = format('%s - %s', text, votes)
else:
s = format('\x02#%i [%s]\x02: %s - %s %u', fmlid,
category, text, votes, url)
irc.reply(s)
fml = wrap(fml, [additional('positiveInt')])