Browse Source

Refactor: Changed customcommands to better reflect on the changes to blacklisting.

tags/v2.0.0
Roxie Gibson 5 years ago
parent
commit
6721801242
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      roxbot/cogs/customcommands.py

+ 11
- 4
roxbot/cogs/customcommands.py View File

@@ -104,16 +104,23 @@ class CustomCommands:
return output

async def on_message(self, message):
# Limits customcommands to pm's as customcommands are handled at a guild level.
if roxbot.blacklisted(message.author) or not isinstance(message.channel, discord.TextChannel):
return
"""
"""
# Emulate discord.py's feature of not running commands invoked by the bot (expects not to be used for self-botting)
if message.author == self.bot.user:
return

# Limit custom commands to guilds only.
if not isinstance(message.channel, discord.TextChannel):
return

# Emulate Roxbot's blacklist system
if roxbot.blacklisted(message.author):
raise commands.CheckFailure()

settings = roxbot.guild_settings.get(message.guild)
msg = message.content.lower()
channel = message.channel

if msg.startswith(self.bot.command_prefix):
command = msg.split(self.bot.command_prefix)[1]
if command in settings["custom_commands"]["1"]:

Loading…
Cancel
Save