.BANCHO. Add !report command

This commit is contained in:
Nyo
2016-12-11 23:12:06 +01:00
parent b4d498c26c
commit daf457fc5c
5 changed files with 104 additions and 7 deletions

View File

@@ -175,6 +175,10 @@ def sendMessage(fro = "", to = "", message = "", token = None, toIRC = True):
if token.isSilenced():
raise exceptions.userSilencedException()
# Redirect !report to FokaBot
if message.startswith("!report"):
to = "FokaBot"
# Determine internal name if needed
# (toclient is used clientwise for #multiplayer and #spectator channels)
toClient = to
@@ -190,7 +194,6 @@ def sendMessage(fro = "", to = "", message = "", token = None, toIRC = True):
toClient = "#spectator"
elif to.startswith("#multi_"):
toClient = "#multiplayer"
# Truncate message if > 2048 characters
message = message[:2048]+"..." if len(message) > 2048 else message
@@ -216,6 +219,9 @@ def sendMessage(fro = "", to = "", message = "", token = None, toIRC = True):
if glob.channels.channels[to].publicWrite == False and token.admin == False:
raise exceptions.channelNoPermissionsException()
# Add message in buffer
token.addMessageInBuffer(to, message)
# Everything seems fine, build recipients list and send packet
glob.streams.broadcast("chat/{}".format(to), packet, but=[token.token])
else: