#cog loaded but slash command not available

1 messages · Page 1 of 1 (latest)

near thicket
#

I am recursively loading cog files (its just one for testing) and the cog file is reported as loaded, however the command does not show up in discord. Trying to add a command without cog makes it show up instantly.

@bot.event
async def on_ready():
    # await bot.sync_commands(force=True, check_guilds=bot.debug_guilds)
    print(f"[-] We have logged in as {bot.user}")
    for guild in await bot.fetch_guilds(limit=150).flatten():
        print(f"[-] {guild.name} ({guild.id})")

    try:
        ret = bot.load_extensions("cogs.enabled", recursive=True)
        for cog in ret:
            print(f"[✓] Loaded {cog}")
        
    except Exception as e:
        print(f"[x] Failed to load cogs")
        print(f"[!] Error: {e}")

@bot.command() # this works
async def eeeerrr(self):
    raise Exception("This is an error")

returns

PS D:\Slluxx\Documents\GitHub\YippyBot> py .\start.py
[-] We have logged in as yipy#4829
[-] Personal Hax4dayz Testing Server (864815355666890752)
[-] testingground (951238286834278450)
[✓] Loaded cogs.enabled.util.userinfo

the cog file contents is this example cog from pycord:
https://github.com/Pycord-Development/pycord/blob/master/examples/app_commands/slash_cog.py

GitHub

Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/slash_cog.py at master · Pycord-Development/pycord

abstract shore
near thicket
#

no, i removed the id=[] thing to make it valid

abstract shore
#

also, do you override the on_connect event?

near thicket
#

no

abstract shore
near thicket
#

i may have found the solution myself

#

one sec

half fjord
#

.slashnoshow

hushed epochBOT
#

Checklist for Application Commands Not Showing Up:
• Does your bot have the application.commands scope?
• Are you loading cogs before on_ready and on_connect?
• Is on_connect not overridden?
• Did you update to the newest version of py-cord (tag: install)?
• Is User Settings > Accessibility > Chat Input > Use legacy chat input turned off?
• Did you share your code and errors?
• Do you still have libraries that conflict with the discord namespace (e.g. discord.py)?

abstract shore
#

oh right. 2nd point

near thicket
#

Are you loading cogs before on_ready and on_connect?

#

yeah

#

i could have sworn that it used to work

abstract shore
#

it worked for prefix cmds

#

but since slash cmds are discord end, they need to be registered

near thicket
#

yeah i guess so, allthough i have currently bots that also load cogs inside on_ready

#

just not recursive

#

hm

#

well, i found the solution so thank you!

abstract shore
#

.close

hushed epochBOT
#

Done with your help thread?

Please close your own help thread by using </close:1009144375709814897> with @south grotto.