test
This commit is contained in:
parent
dba9c21b4c
commit
57401396e6
@ -1,4 +1,6 @@
|
||||
|
||||
import collections
|
||||
import textwrap
|
||||
|
||||
from sopel import plugin
|
||||
|
||||
@ -16,7 +18,19 @@ def sb_test_commands(bot, trigger):
|
||||
@plugin.nickname_command('command_groups')
|
||||
def sb_test_command_groups(bot, trigger):
|
||||
|
||||
sb.osd(str(bot.command_groups.keys()), trigger.sender)
|
||||
msgs = []
|
||||
|
||||
name_length = max(6, max(len(k) for k in bot.command_groups.keys()))
|
||||
for category, cmds in collections.OrderedDict(sorted(bot.command_groups.items())).items():
|
||||
category = category.upper().ljust(name_length)
|
||||
cmds = set(cmds) # remove duplicates
|
||||
cmds = ' '.join(cmds)
|
||||
msg = category + ' ' + cmds
|
||||
indent = ' ' * (name_length + 2)
|
||||
# Honestly not sure why this is a list here
|
||||
msgs.append('\n'.join(textwrap.wrap(msg, subsequent_indent=indent)))
|
||||
|
||||
sb.osd(msgs, trigger.sender)
|
||||
|
||||
|
||||
@prerun()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user