[Alias, CC] Check presence of messages' prefix before anything else (#462)

Less expensive
This commit is contained in:
Caleb Johnson
2016-11-10 18:27:26 -06:00
committed by Twentysix
parent b5be746783
commit 495762254e
2 changed files with 11 additions and 10 deletions

View File

@@ -106,17 +106,18 @@ class CustomCommands:
await self.bot.say("There are no custom commands in this server. Use addcom [command] [text]")
async def checkCC(self, message):
if message.author.id == self.bot.user.id or len(message.content) < 2 or message.channel.is_private:
return
if not user_allowed(message):
if message.author == self.bot.user or\
len(message.content) < 2 or message.channel.is_private:
return
msg = message.content
server = message.server
prefix = self.get_prefix(msg)
if prefix and server.id in self.c_commands.keys():
if not prefix:
return
if server.id in self.c_commands and user_allowed(message):
cmdlist = self.c_commands[server.id]
cmd = msg[len(prefix):]
if cmd in cmdlist.keys():