Red-DiscordBot/redbot/core/global_checks.py
Michael H 1852420b98
[Core] Add Red.message_eligible_as_command (#4077)
* [Core] Add `Red.message_eligible_as_command`

  - This is a small utility function which makes it easy for cog
  creators to treat non-command messages as commands correctly.

  - This also modifies `Red.ignored_channel_or_guild`'s signature to
  explicitly add support for passing a message object (the only needed
  attributes are entirely shared with context)

* Update redbot/core/bot.py

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* address review

* Rename

* remove webhhok check, the issue wasn't possible under normal operation

* Ah yes, ctx.bot in a method of the bot...

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
2020-07-18 15:38:57 +02:00

9 lines
281 B
Python

"""The checks in this module run on every command."""
from . import commands
def init_global_checks(bot):
@bot.check_once
async def check_message_is_eligible_as_command(ctx: commands.Context) -> bool:
return await ctx.bot.message_eligible_as_command(ctx.message)