aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCerapter <cerap@protonmail.com>2018-08-12 00:32:43 +0200
committerCerapter <cerap@protonmail.com>2018-08-12 00:32:43 +0200
commitd444eb6dceb47123940baed5a255572d24567dc8 (patch)
tree7baa1ee90e221eed9da4501162ca426153e588bf
parent3759131a8f0c0d65e14fdda9748de300dc23670d (diff)
Modchat for mods to chat secretly across areas.
Called with `/m [message]`.
-rw-r--r--server/commands.py8
-rw-r--r--server/tsuserver.py8
2 files changed, 16 insertions, 0 deletions
diff --git a/server/commands.py b/server/commands.py
index f58dbea2..b8748eda 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 9438a350..a7aed5db 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('<dollar>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