From 9425043b1e2a783daf20727869255ae6f3dc45ae Mon Sep 17 00:00:00 2001 From: Giuseppe Guerra Date: Mon, 7 Aug 2017 21:48:09 +0200 Subject: [PATCH] Add !mp kick --- constants/fokabotCommands.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/constants/fokabotCommands.py b/constants/fokabotCommands.py index e1709bb..2c731ad 100644 --- a/constants/fokabotCommands.py +++ b/constants/fokabotCommands.py @@ -941,6 +941,21 @@ def multiplayer(fro, chan, message): _match.abort() return "Match aborted!" + def mpKick(): + if len(message) < 2: + raise exceptions.invalidArgumentsException("Wrong syntax: !mp kick ") + 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: subcommands = { "make": mpMake, @@ -957,6 +972,7 @@ def multiplayer(fro, chan, message): "map": mpMap, "set": mpSet, "abort": mpAbort, + "kick": mpKick, } requestedSubcommand = message[0].lower().strip() if requestedSubcommand not in subcommands: