Finally caved in and created a command table. It's just going to get too messy with @-commands doing straight module lookups, plus the dict is probably a little faster. Feel free to start moving non-privved @-commands to commands_general and vice-versa since we now have the ability to do so.

This commit is contained in:
Greg Taylor 2007-05-11 15:23:27 +00:00
parent 2fc06adcfa
commit ac32ab05c1
7 changed files with 174 additions and 43 deletions

View file

@ -1,8 +1,10 @@
from apps.objects.models import CommChannel
import session_mgr
import commands_privileged
import commands_general
import commands_comsys
import commands_unloggedin
import ansi
"""
Comsys functions.
"""
@ -21,3 +23,17 @@ def get_com_who(channel, muted=False, disconnected=False):
def get_user_channels(player):
pass
def create_channel(cdat):
"""
Create a new channel. cdat is a dictionary that contains the following keys.
REQUIRED KEYS:
* name: The name of the new channel.
* owner: The creator of the channel.
"""
new_chan = CommChannel()
new_chan.name = ansi.parse_ansi(cdat["name"], strip_ansi=True)
new_chan.header = "[%s]" % (ansi.parse_ansi(cdat["name"]),)
new_chan.set_owner(cdat["owner"])
new_chan.save()
return new_chan