.BANCHO. Kick all clients when using !kick, don't kick FokaBot with !kick command

This commit is contained in:
Nyo
2016-12-11 11:39:01 +01:00
parent 44545c3bcb
commit b4d498c26c
4 changed files with 36 additions and 17 deletions

View File

@@ -119,15 +119,18 @@ def kickAll(fro, chan, message):
def kick(fro, chan, message):
# Get parameters
target = message[0].replace("_", " ")
target = message[0].lower().replace("_", " ")
if target == "fokabot":
return "Nope."
# Get target token and make sure is connected
targetToken = glob.tokens.getTokenFromUsername(target)
if targetToken is None:
tokens = glob.tokens.getTokenFromUsername(target, all=True)
if len(tokens) == 0:
return "{} is not online".format(target)
# Kick user
targetToken.kick()
# Kick users
for i in tokens:
i.kick()
# Bot response
return "{} has been kicked from the server.".format(target)