Added dynamic formatting to comm channel, as inspired by the way done in Arxmush.

This commit is contained in:
Griatch 2016-04-07 19:48:11 +02:00
parent 653a46b7ad
commit d00ff9ae32

View file

@ -32,15 +32,13 @@ from django.utils.translation import ugettext as _
class ChannelCommand(command.Command): class ChannelCommand(command.Command):
""" """
Channel {channelkey} channel
Usage: Usage:
<channel name or alias> <message> {lower_channelkey} <message>
{lower_channelkey} history <num>[-<num>]
This is a channel. If you have subscribed to it, you can send to
it by entering its name or alias, followed by the text you want to
send.
{channeldesc}
""" """
# this flag is what identifies this cmd as a channel cmd # this flag is what identifies this cmd as a channel cmd
# and branches off to the system send-to-channel command # and branches off to the system send-to-channel command
@ -179,6 +177,11 @@ class ChannelHandler(object):
obj=channel, obj=channel,
arg_regex=r"\s.*?", arg_regex=r"\s.*?",
is_channel=True) is_channel=True)
# format the help entry
key = channel.key
cmd.__doc__ = cmd.__doc__.format(channelkey=key,
lower_channelkey=key.strip().lower(),
channeldesc=channel.db.desc.strip())
self.cached_channel_cmds.append(cmd) self.cached_channel_cmds.append(cmd)
self.cached_cmdsets = {} self.cached_cmdsets = {}