Skip to content
Is it possible to use slash commands on replit when coding a python Discord bot?
Profile icon
cachdies

I am coding a Discord Bot in Python. I have my bot up and running but I would like to upgrade it so that I can use slash (/) commands. However, even the most simple code fails because whenever I try from discord_slash import SlashCommand I get the following error:

Traceback (most recent call last): File "main.py", line 5, in <module> from discord_slash import SlashCommand ModuleNotFoundError: No module named 'discord_slash'

Since there is no terminal for me to use pip install I don't know how to solve this as all articles I've found online indicate that this should work. Likewise, I've found that when it doesn't the fix seems to be to re-install discord using pip. Does anyone know if this can be fixed? or is this a limitation of replit?
Thanks!

You are viewing a single comment. View All
Profile icon
xfinnbar

Select the packages section in the toolbar.
https://storage.googleapis.com/replit/images/1617644864726_76fc9aaa78f2a57101a5b027f6f417de.png. From there, add "discord-py-slash-command". It will now be installed every time you restart your repl.

Profile icon
cachdies

@xfinnbar
That works thanks!

Profile icon
bladeinblood

discord-py-slash-command was not installed. There may have been an error — check the Console tab for [email protected]

Profile icon
AllmightyChaos

@xfinnbar
If I try to install that one, it returns the error "Replit: Package operation failed.", how can I change that?

Profile icon
cachdies

@AllmightyChaos
You have to look for another one. Discod.py died and then got resurrected so depending on what fork you are using you would probably have to use different packages. You can always google that error too: https://replit.com/talk/ask/What-does-Replit-Package-operation-failed-mean/37267