Misc: Make @help mention '@plugin help' when relevant.

This commit is contained in:
Valentin Lorentz 2021-04-05 14:39:41 +02:00
parent 9323302704
commit 49eef1cd7d
2 changed files with 28 additions and 3 deletions

View File

@ -314,9 +314,20 @@ class Misc(callbacks.Plugin):
s = format(_('There is no command %q.'), s = format(_('There is no command %q.'),
callbacks.formatCommand(command)) callbacks.formatCommand(command))
if command[0].lower() in map(str.lower, plugins): if command[0].lower() in map(str.lower, plugins):
s += (' However, "{0}" is the name of a loaded plugin, and ' if "Plugin" in plugins:
'you may be able to find its provided commands ' template = _(
'using \'list {0}\'.'.format(command[0].title())) " However, '{0}' is the name of a loaded plugin, and "
"you may be able to find its help using "
"'plugin help {0}' and its provided commands using "
"'list {0}'."
)
else:
template = _(
" However, '{0}' is the name of a loaded plugin, and "
"you may be able to find its provided commands using "
"'list {0}'."
)
s += template.format(command[0].title())
irc.error(s) irc.error(s)
help = wrap(help, [any('something')]) help = wrap(help, [any('something')])

View File

@ -83,6 +83,20 @@ class MiscTestCase(ChannelPluginTestCase):
#self.assertRegexp('help misc help', r'^\(\x02misc help') #self.assertRegexp('help misc help', r'^\(\x02misc help')
self.assertError('help nonExistentCommand') self.assertError('help nonExistentCommand')
def testPluginHelp(self):
self.assertResponse('help Misc',
'Error: There is no command "misc". '
"However, 'Misc' is the name of a loaded plugin, "
"and you may be able to find its help using "
"'plugin help Misc' and its provided "
"commands using 'list Misc'.")
self.assertNotError('unload Plugin')
self.assertResponse('help Misc',
'Error: There is no command "misc". '
"However, 'Misc' is the name of a loaded plugin, "
"and you may be able to find its provided commands using "
"'list Misc'.")
def testHelpIncludeFullCommandName(self): def testHelpIncludeFullCommandName(self):
self.assertHelp('help channel capability add') self.assertHelp('help channel capability add')
m = self.getMsg('help channel capability add') m = self.getMsg('help channel capability add')