Bladeren bron

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

tags/v2.0.0
Roxie Gibson 5 jaren geleden
bovenliggende
commit
6721801242
1 gewijzigde bestanden met toevoegingen van 11 en 4 verwijderingen
  1. +11
    -4
      roxbot/cogs/customcommands.py

+ 11
- 4
roxbot/cogs/customcommands.py Bestand weergeven

@@ -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"]:

Laden…
Annuleren
Opslaan