I'm trying to make a DM help command for my bot which is automatically generated depending on how many commands I add. I want it to omit commands with the guild_only check.
Here's my code:
import discord
from discord.ext import commands
...
...
# Imagine that in this case, `command` is a command with the `guild_only` check.
# This is in a much larger for loop
if commands.guild_only not in command.checks:
# add command to string of commands
help_c = ''.join([help_c, f"`{ctx.prefix}{command.name}{brief}`"
f"{separate_into_aliases(command)}\n{desc}\n\n"])
I assumed commands.guild_only not in command.checks would return False since the guild_only check is in the list of checks. But it didn't.
Here's the list the check attribute of a command with guild_only returns:
[<function guild_only.<locals>.predicate at 0x04A60150>]
And here's commands.guild_only:
<function guild_only at 0x0481F150>
The two are similar but not the same.
My question is how can I check if a command has the guild_only check in its checks attribute?