#Pycord's example slash command in cog didn't work
1 messages · Page 1 of 1 (latest)
if i am not mistaked, you'll need to specify a name for the slash command as well, how else would you call it in discord
@commands.slash_command(
name='ping',
description='Pinging.')
or such
any specific error that you get?
nothing
try changing command.Bot(...) to discord.Bot()
oke but how do I put the prefix ?
you don't need it if you use slash command
Both is fine
thus slash command
You load the cogs at the on_ready event, that is why it is not working
Just move it outside the event
tysm it work
.close
Done with your help thread?
Please close your own help thread by using </close:1009144375709814897> with @hasty bolt.
This thread was archived by the user that opened it.
if you are funny you could use something like this:
import os
def load_cogs():
for foldername, subfolders, filenames in os.walk('commands'):
for filename in filenames:
if filename.endswith('.py') and filename not in ['list of', 'files you', 'wanna ignore.py']:
print_timestamp(filename, 'Trying to load in ')
extension = os.path.join(foldername, filename).replace('.py', '').replace('/', '.')
try:
bot.load_extension(extension)
print(f'Successfully loaded extension: {extension}')
except Exception as e:
print(f'Failed to load extension {extension}: {e}')
load_cogs()
You dont need that if you do requirsive=True
You don't
okay chat didnt load bruh, discord istg
thought that that prob. exists but wanted to implement it myself for the funnsies
and also do i have more control over it and easy access for my own error logging script
thx, may use it if I would rewrite my bot
By default it uses the function name