#slash commands dissappearing
1 messages · Page 1 of 1 (latest)
It happens to me occasionally, I do is switch between channels on the server until it loads
If you don't have the guild specified it will take up to 1 hour to update because it's a global command
Or probably bug on discord servers 🤨
well, let's wait
it's a bug copium
is it normal that in version 2.0.0 we can no longer use the commands a prefix?
I may be wrong but I think if you want to use both prefix and slash commands you have to use discord.ext.bridge I wanna say that was introduced with 2.0.0 b6 or b7
Concept
Thanks for this information ^^
If you don't use this, the slash and prefix commands don't work in 2.0.0?
you need that intent on in the dev portal as well
normally I activated everything on the dev portal
I still use this very old method for prefix commands in the current version 2.0.0 and it works for me
Although I don't recommend it knowing that bridges exist (actually I just found out about bridges and I think I'll start changing my old code too)
Main File
from discord.ext import commands
bot = commands.Bot(command_prefix = '!', help_command=None)
#Legacy commands
bot.load_extension(f'cog.legacycommands')```
Cog in other file
```import discord
from discord.ext import commands
class Legacy(commands.Cog):
def __init__(self,client):
self.client = client
@commands.command(name="test")
async def test(self,ctx):
await ctx.send(content="Hi!")
def setup(client):
client.add_cog(Legacy(client))
WoW! unfortunately I do not use the "Cog" ...
so start using cogs
What more does it bring?
I have been testing and this works guys
from discord.ext import commands
#Message Content must be enabled in the developer portal
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(commands.when_mentioned_or("!"), help_command=None, intents=intents)
@bot.command()
async def ping(ctx):
await ctx.send("Hi!")```
cogs primarily makes it easier to categorize your classes and functions. you can avoid it but at one point it will become really messy to keep everything in your main.py, as opposed to splitting it out and keeping it organized
it's not different from my code though 🤔
must be a huge mess in my code then 😳
"Cog" serves ordered code?
prefix doesn't work but mentioning the bot work?
wym by ordered code
I did not try 🤔 When it will be operational again I will let you know.
I'm going to find out about getting "Cog" and see if I can optimize my program with that
If you have "Message Content Intent" enabled in the developer portal you should not see any problem, if it only works mentioning without the prefix it is because it is not enabled, although it should also notify an error when trying to execute the code.
Good luck!
cogs are just a way to add stuff to your bot without having to use a singular .py file. it does the same as adding commands any other way but make it easier to keep organized and classed appropriately. another thing with cogs is that you can make changes to a cog and then reload that specific cog for the changes to take effect without having to reboot the entire instance of the bot
and thank you for your information ^^
I'm interested in restarting a section of the program without restarting the file entirely 🤔
From what I understood anyway
the mentions also do not work
I tried with this but the prefix commands still don't work and the slash commands stop after about 1 minute
I recommend create a post specifying the problem and errors that appear so more people can help you. I still recommend that if you had an old version of Pycord you completely uninstall it and reinstall.
In case you have Discordpy installed for some strange reason, uninstall.
I don't have it
hey idk if anyone else has this problem but like after i do one of my slash commands (testing) it disappears and shows old slash commands
just wait some minutes
i do then it disappears again...
dang
ive waited like 15 mins and still
nvm i found a fix
Ooh, what fix? I'm having a similar issue.
Make sure you don’t have multiple instances of your bot running.
I'm not entirely sure how I would do that or where I would look? Any follow-up information you can give me? ^.^
Usually when this happened to me ( I’ve had it happen twice now ) is my web hosting service seemed to be stuck and was hosting my not even though I had turned it off. I had to generate a new token to kill the extra hosts. But same issue that you was having. I would create a new slash command in my code. Run it locally and use it once then it would disappear.
Ooh, good to know, I'll take a look at my hosting service. Thanks much! 
Hmm, that didn't seem to have any effect. I'm confused though because I have a test instance of the bot that only runs on my computer, and it isn't displaying all of one slash command group either.
And I'm certain I only have one of those running lol
Hmm well narrowing it down. It may be helpful to post your relevant code (excluding any tokens or sensitive information)
Hmm, I'll be honest, I'm not even remotely sure where the problem might be, so I'm not sure what's relevant.
Let's see
main.py
load_dotenv()
bot = FroggeBot(
command_prefix = ">>",
intents = discord.Intents.all(),
owner_id = os.getenv("ALLEGRO"),
case_insensitive = True
)
######################################################################
# Load modules - This part is magic.
for filename in os.listdir("./cogs"):
if filename.endswith(".py") and filename != "__init__.py":
bot.load_extension(f"cogs.{filename[:-3]}")
######################################################################
# Ready go!
bot.run(os.getenv("DISCORD_TOKEN"))
######################################################################```
Pretty standard
Here's the Cog that's having issues.
######################################################################
class Profiles(Cog):
"""The Cog with commands invoking Profile functions.
Attributes
-----------
bot: The bot, duh. This is important and required by the superclass.
"""
def __init__(self, bot: FroggeBot):
"""Init's the Profiles module."""
self.bot: FroggeBot = bot
######################################################################
# Create command group
profiles = SlashCommandGroup(
name="profile",
description="Commands for profile creation."
)
######################################################################
@profiles.command(
name="test",
description="Test Me Mommy",
guild_ids=GUILDS
)
async def profile_test(self, ctx: ApplicationContext):
await ctx.respond("Testing!")
######################################################################```