Fix [p]cleanup bot (#1205)

This commit is contained in:
Tobotimus 2018-01-15 15:20:54 +11:00 committed by Kowlin
parent f1a20e1677
commit e18f94c17d

View File

@ -221,14 +221,9 @@ class Cleanup:
author = ctx.message.author author = ctx.message.author
is_bot = self.bot.user.bot is_bot = self.bot.user.bot
prefixes = self.bot.command_prefix prefixes = await self.bot.get_prefix(ctx.message) # This returns all server prefixes
if isinstance(prefixes, str): if isinstance(prefixes, str):
prefixes = [prefixes] prefixes = [prefixes]
elif callable(prefixes):
if asyncio.iscoroutine(prefixes):
await ctx.send(_('Coroutine prefixes not yet implemented.'))
return
prefixes = prefixes(self.bot, ctx.message)
# In case some idiot sets a null prefix # In case some idiot sets a null prefix
if '' in prefixes: if '' in prefixes:
@ -241,7 +236,8 @@ class Cleanup:
return True return True
p = discord.utils.find(m.content.startswith, prefixes) p = discord.utils.find(m.content.startswith, prefixes)
if p and len(p) > 0: if p and len(p) > 0:
return m.content[len(p):].startswith(tuple(self.bot.commands)) cmd_name = m.content[len(p):].split(' ')[0]
return bool(self.bot.get_command(cmd_name))
return False return False
to_delete = [ctx.message] to_delete = [ctx.message]