Repository: Cog-Creators/Red-DiscordBot

Issue:
[p]licenseinfo and slash commands
The deadline is coming, Discord will soon remove message content for most bots, forcing us to migrate to slash commands.

It has been told countless times that Red does not support public bots and it is fully up to us if we want to host a large public bot, which most of us already understood by using a custom fork.

However, there is a problem with that: the `[p]licenseinfo` command. It has been made for traditional commands and cannot be modified. So, when slash commands kick in, is Discord responsible for blocking access to this command?

Not supporting slash commands is perfectly fine, but in the current state of the bot, it is outright illegal to have a slash-only bot. The command is inaccessible and requires editing to work.

----

This is not a specific feature request, I'm asking for clarifications as to how we should implement this command on slash-commands only bots. I see multiple ways of doing this:

- Allow and require the bot/fork owner to implement his slash version of licenseinfo, not touching the original text
- Provide a slash-command compatible version of licenseinfo. Red doesn't manage interactions by default and people use plenty of different libs, so that would be kinda difficult to implement
- Respond to the bot mention, aka `@Redbot licenseinfo` will always respond, even if the bot mention isn't a prefix


Discussion:
If you require the Message Content Intent to be enabled like the other intents before having the ability to install Red, technically nothing should change and Red should be able to read message content like normal. It should be noted that this has been mentioned in the [Message Content Policy](https://support.discord.com/hc/en-us/articles/4410940809111#h_01FJ9G3JV1H0HN25C4V7X3RHD4).
![img](https://i.imgur.com/p5LbiD4.png)
_If there's something bigger that's at stake and I'm just not understanding then apologies for being ignorant.  How I'm thinking about this is once you require the message intent to be enabled, you shouldn't have to do anything slash command related._
> If you require the Message Content Intent to be enabled like the other intents before having the ability to install Red

There is no way to prevent install based on whether intents are enabled, but we can (and do) prevent the bot from launching without intents by default. However, a non-zero number of users have modified versions of the bot to bypass this restriction in various ways in order to use red as a public bot. Obviously this is not supported, however it is permissible by the license, *assuming they maintain the licenseinfo command*. This issue is pointing out the fact that it is not possible to keep the licenseinfo command usable on a slash-only bot (as required by the current wording of the license), so these users would be unable to legally host modified versions of red purely because they cannot maintain the specific implementation of the licenseinfo command that is currently required. They are requesting that an alternative option be provided, otherwise they will be unable to use red how they currently are in a legal way.
@Flame442 ~~Red is only licensed under the GPL, not the AGPL, so there is no requirement for a `licenseinfo` command on modified bots, also because the output of `licenseinfo` doesn't appear to qualify under the Appropriate Legal Notices definition.~~

~~Edit 2: And the only reason a `licenseinfo` command might be necessary is if the fork is being sent to someone else.~~

~~Is there something I'm missing? (Also, not a lawyer, so yeah.)~~

Edit 3: Ah, never mind, it might be required. It doesn't appear to be required, though, unless the modified bot is conveyed.
While I won't comment on whether other methods of displaying credit/copyright information would be considered valid under the license (IANAL, contact a lawyer for legal advice), I will say that it is what we generally expect from any instance or fork of red -- including a public instance. This issue exists not to argue about semantics about the license, it is to keep us aware of how the upcoming changes to the discord API will affect that specific command.

Resolving patch:
diff --git a/redbot/core/bot.py b/redbot/core/bot.py
--- a/redbot/core/bot.py
+++ b/redbot/core/bot.py
@@ -1589,6 +1589,22 @@ async def process_commands(self, message: discord.Message, /):
         """
         if not message.author.bot:
             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):
                 log.warning(
                     "Discarded a command message (ID: %s) with PartialMessageable channel: %r",


Test patch: