This commit is contained in:
deathbybandaid 2022-02-12 15:21:45 -05:00
parent 57401396e6
commit 3e3eb2af77

View File

@ -1,6 +1,5 @@
import collections import collections
import textwrap
from sopel import plugin from sopel import plugin
@ -20,17 +19,14 @@ def sb_test_command_groups(bot, trigger):
msgs = [] 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(): for category, cmds in collections.OrderedDict(sorted(bot.command_groups.items())).items():
category = category.upper().ljust(name_length) bot.say(category)
cmds = set(cmds) # remove duplicates cmds = set(cmds) # remove duplicates
cmds = ' '.join(cmds) cmds = ' '.join(cmds)
msg = category + ' ' + cmds msg = category + ' ' + cmds
indent = ' ' * (name_length + 2) msgs.append(msg)
# Honestly not sure why this is a list here
msgs.append('\n'.join(textwrap.wrap(msg, subsequent_indent=indent)))
sb.osd(msgs, trigger.sender) # sb.osd(msgs, trigger.sender)
@prerun() @prerun()