.BANCHO. Update ranks, add !alertuser command

This commit is contained in:
Nyo
2016-05-28 20:26:26 +02:00
parent e483a92a2c
commit dc0e3ef459
5 changed files with 57 additions and 15 deletions

View File

@@ -5,6 +5,7 @@ from constants import actions
from constants import serverPackets
from constants import fokabotCommands
import re
from helpers import generalFunctions
# Tillerino np regex, compiled only once to increase performance
npRegex = re.compile("^https?:\\/\\/osu\\.ppy\\.sh\\/b\\/(\\d*)")
@@ -35,14 +36,21 @@ def fokabotResponse(fro, chan, message):
for i in fokabotCommands.commands:
# Loop though all commands
if i["trigger"] in message:
#if i["trigger"] in message:
if generalFunctions.strContains(message, i["trigger"]):
# message has triggered a command
# Make sure the user has right permissions
if i["minRank"] > 1:
# Get rank from db only if minrank > 1, so we save some CPU
if userHelper.getRankPrivileges(userHelper.getID(fro)) < i["minRank"]:
if i["rank"] != None:
# Rank = x
if userHelper.getRankPrivileges(userHelper.getID(fro)) != i["rank"]:
return False
else:
# Rank > x
if i["minRank"] > 1:
# Get rank from db only if minrank > 1, so we save some CPU
if userHelper.getRankPrivileges(userHelper.getID(fro)) < i["minRank"]:
return False
# Check argument number
message = message.split(" ")