Add !mp kick

This commit is contained in:
Giuseppe Guerra 2017-08-07 21:48:09 +02:00
parent f660a20f60
commit 9425043b1e

View File

@ -941,6 +941,21 @@ def multiplayer(fro, chan, message):
_match.abort() _match.abort()
return "Match aborted!" return "Match aborted!"
def mpKick():
if len(message) < 2:
raise exceptions.invalidArgumentsException("Wrong syntax: !mp kick <username>")
username = message[1]
userID = userUtils.getIDSafe(username)
if userID is None:
raise exceptions.userNotFoundException("No such user")
_match = glob.matches.matches[getMatchIDFromChannel(chan)]
slotID = _match.getUserSlotID(userID)
if slotID is None:
raise exceptions.userNotFoundException("The specified user is not in this match")
for i in range(0, 2):
_match.toggleSlotLocked(slotID)
return "{} has been kicked from the match.".format(username)
try: try:
subcommands = { subcommands = {
"make": mpMake, "make": mpMake,
@ -957,6 +972,7 @@ def multiplayer(fro, chan, message):
"map": mpMap, "map": mpMap,
"set": mpSet, "set": mpSet,
"abort": mpAbort, "abort": mpAbort,
"kick": mpKick,
} }
requestedSubcommand = message[0].lower().strip() requestedSubcommand = message[0].lower().strip()
if requestedSubcommand not in subcommands: if requestedSubcommand not in subcommands: