mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Always allow licenseinfo to be run with a mention prefix (#5865)
Co-authored-by: Zephyrkul <23347632+Zephyrkul@users.noreply.github.com>
This commit is contained in:
parent
7c7e5edb19
commit
6774801649
@ -1589,6 +1589,22 @@ class Red(
|
|||||||
"""
|
"""
|
||||||
if not message.author.bot:
|
if not message.author.bot:
|
||||||
ctx = await self.get_context(message)
|
ctx = await self.get_context(message)
|
||||||
|
|
||||||
|
# The licenseinfo command must always be available, even in a slash only bot.
|
||||||
|
# To get around not having the message content intent, a mention prefix
|
||||||
|
# will always work for it.
|
||||||
|
if not ctx.valid:
|
||||||
|
for m in (f"<@{self.user.id}> ", f"<@!{self.user.id}> "):
|
||||||
|
if message.content.startswith(m):
|
||||||
|
ctx.view.undo()
|
||||||
|
ctx.view.skip_string(m)
|
||||||
|
invoker = ctx.view.get_word()
|
||||||
|
command = self.all_commands.get(invoker, None)
|
||||||
|
if isinstance(command, commands.commands._AlwaysAvailableMixin):
|
||||||
|
ctx.command = command
|
||||||
|
ctx.prefix = m
|
||||||
|
break
|
||||||
|
|
||||||
if ctx.invoked_with and isinstance(message.channel, discord.PartialMessageable):
|
if ctx.invoked_with and isinstance(message.channel, discord.PartialMessageable):
|
||||||
log.warning(
|
log.warning(
|
||||||
"Discarded a command message (ID: %s) with PartialMessageable channel: %r",
|
"Discarded a command message (ID: %s) with PartialMessageable channel: %r",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user