diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 9192fac1c..0a18698ed 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -152,6 +152,10 @@ class Bot(GroupMixin, discord.Client): :attr:`Context.prefix`. description : str The content prefixed into the default help message. + self_bot : bool + If ``True``, the bot will only listen to commands invoked by itself rather + than ignoring itself. If ``False`` (the default) then the bot will ignore + itself. This cannot be changed once initialised. formatter : :class:`HelpFormatter` The formatter used to format the help message. By default, it uses a the :class:`HelpFormatter`. Check it for more info on how to override it. @@ -192,6 +196,8 @@ class Bot(GroupMixin, discord.Client): self.command_not_found = options.pop('command_not_found', 'No command called "{}" found.') self.command_has_no_subcommands = options.pop('command_has_no_subcommands', 'Command {0.name} has no subcommands.') + self._skip_check = discord.User.__ne__ if options.pop('self_bot', False) else discord.User.__eq__ + self.help_attrs = options.pop('help_attrs', {}) self.help_attrs['pass_context'] = True @@ -457,7 +463,7 @@ class Bot(GroupMixin, discord.Client): return self.cogs.get(name) def remove_cog(self, name): - """Removes a cog the bot. + """Removes a cog from the bot. All registered commands and event listeners that the cog has registered will be removed as well. @@ -578,7 +584,7 @@ class Bot(GroupMixin, discord.Client): _internal_author = message.author view = StringView(message.content) - if message.author == self.user: + if self._skip_check(message.author, self.user): return prefix = self._get_prefix(message)