diff --git a/server/commands.py b/server/commands.py index f58dbea..b8748ed 100644 --- a/server/commands.py +++ b/server/commands.py @@ -343,6 +343,14 @@ def ooc_cmd_gm(client, arg): client.server.broadcast_global(client, arg, True) logger.log_server('[{}][{}][GLOBAL-MOD]{}.'.format(client.area.id, client.get_char_name(), arg), client) +def ooc_cmd_m(client, arg): + if not client.is_mod: + raise ClientError('You must be authorized to do that.') + if len(arg) == 0: + raise ArgumentError("You can't send an empty message.") + client.server.send_modchat(client, arg) + logger.log_server('[{}][{}][MODCHAT]{}.'.format(client.area.id, client.get_char_name(), arg), client) + def ooc_cmd_lm(client, arg): if not client.is_mod: raise ClientError('You must be authorized to do that.') diff --git a/server/tsuserver.py b/server/tsuserver.py index 9438a35..a7aed5d 100644 --- a/server/tsuserver.py +++ b/server/tsuserver.py @@ -240,6 +240,14 @@ class TsuServer3: self.district_client.send_raw_message( 'GLOBAL#{}#{}#{}#{}'.format(int(as_mod), client.area.id, char_name, msg)) + def send_modchat(self, client, msg): + name = client.name + ooc_name = '{}[{}][{}]'.format('M', client.area.get_abbreviation(), name) + self.send_all_cmd_pred('CT', ooc_name, msg, pred=lambda x: x.is_mod) + if self.config['use_district']: + self.district_client.send_raw_message( + 'MODCHAT#{}#{}#{}'.format(client.area.id, char_name, msg)) + def broadcast_need(self, client, msg): char_name = client.get_char_name() area_name = client.area.name