#How to use slash command using cogs?
1 messages · Page 1 of 1 (latest)
@split parrot check those
umm i have checked those , but i cant use it yet.
Show the pip list
aiohttp 3.8.1
aiosignal 1.2.0
astunparse 1.6.3
async-timeout 4.0.2
attrs 22.1.0
braceexpand 0.1.7
CacheControl 0.12.11
cachetools 5.2.0
certifi 2022.12.7
cffi 1.15.1
charset-normalizer 2.1.1
click 8.1.3
colorama 0.4.6
cryptography 38.0.4
ffmpeg-python 0.2.0
firebase-admin 6.0.1
Flask 2.2.2
frozenlist 1.3.1
future 0.18.2
google-api-core 2.11.0
google-api-python-client 2.70.0
google-auth 2.15.0
google-auth-httplib2 0.1.0
google-cloud-core 2.3.2
google-cloud-firestore 2.7.3
google-cloud-storage 2.7.0
google-crc32c 1.5.0
google-resumable-media 2.4.0
googleapis-common-protos 1.57.0
grpcio 1.51.1
grpcio-status 1.51.1
httplib2 0.21.0
idna 3.3
imageio-ffmpeg 0.4.7
import-expression 1.1.4
importlib-metadata 5.2.0
itsdangerous 2.1.2
Jinja2 3.1.2
jishkucord 2.5.2
line-profiler 4.0.2
MarkupSafe 2.1.1
msgpack 1.0.4
multidict 6.0.2
numpy 1.23.3
pip 22.3.1
proto-plus 1.22.1
protobuf 4.21.12
py-cord 2.1.1
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycord 0.1.1
pycparser 2.21
PyJWT 2.6.0
pymongo 4.2.0
pyparsing 3.0.9
requests 2.28.1
rsa 4.9
setuptools 41.2.0
six 1.16.0
typing_extensions 4.4.0
uritemplate 4.1.1
urllib3 1.26.13
Werkzeug 2.2.2
wheel 0.38.4
yarl 1.8.1
zipp 3.11.0
Wdym you can't use it yet 
i cant use the slashcommand
show the code
# ticket.py
import discord
from discord.ext import commands
class Example(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name='hi')
async def hi(self, ctx: discord.ApplicationContext):
await ctx.respond('hello')
def setup(bot):
bot.add_cog(Example(bot))
@bot.event
async def on_ready():
print('Bot is ready.')
bot.load_extension('cogs.ticket')
you load the cog at on_ready...
do you know basic python?
yeah
if you load the cog at the on_ready event, it will not work
so what should i do to make bot load the extension
remove if from the on_ready event
well, i tried it but it doesn't work well
?tag idw
Saying it doesn't work or asking what's wrong with this code? is not helpful for yourself or others.
Describe what you expect and/or tried (with your code), and what isn't going right.
Please provide any errors you get for optimal assistance.
# main file
@bot.event
async def on_ready():
print('Monde Bot is ready.')
import discord
from discord.ext import commands
class Example(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name='hi')
async def hi(self, ctx: discord.ApplicationContext):
await ctx.respond('hello')
def setup(bot):
bot.add_cog(Example(bot))
the whole main file pls
oof