#Slash commands do not show up
1 messages · Page 1 of 1 (latest)
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)?
Closing this as the user seems to have left the server
im using pycord 2.0.0rc1, for some reason no matter what i do the slash commands dont show up when i try to use them
import discord
from discord.ext import commands
from discord.commands import slash_command
class Test(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(self, message):
if message.author.id == 906318377432281088:
await message.channel.send("working!")
@slash_command(description="Test command")
async def test(self, ctx):
await ctx.send("test")
def setup(bot):
bot.add_cog(Test(bot))
this worked for me: adding a debug_guilds = [guild_ids] in your bot's constructor and then turning them into global commands
when do you load your cogs
class TestBot(commands.Bot):
def __init__(self):
super().__init__(intents=discord.Intents.all())
self.bot = self
self.debug_guilds = None # censored
self.on_start()
def on_start(self):
for cog in [file.replace('.py', '') for file in listdir("cogs") if isfile(join('cogs', file))]:
logger.info(f"Loading cog: {cog}")
try:
self.load_extension('cogs' + '.' + cog)
logger.info(f"Successfully loaded {cog}")
except Exception as e:
logger.error(f"Failed to load {cog}")
logger.error(f"Error: {e}")
in on_start
you need to pass in the debug_guilds into the parent class's init as well. I've never seen on_start used before...
ah ok
still doesnt show up
what does it show if you for loop bot.walk_application_commands()