#slash commands dissappearing

1 messages · Page 1 of 1 (latest)

lost jetty
#

I have the same problem

foggy mountain
# lost jetty I have the same problem

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 🤨

lost jetty
#

well, let's wait

plucky timber
#

it's a bug copium

lost jetty
#

is it normal that in version 2.0.0 we can no longer use the commands a prefix?

frosty bronze
#

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

lost jetty
#

Thanks for this information ^^

lost jetty
gentle mist
#

no, you can use prefix in 2.0.0...

#

you need message content intent for prefix

lost jetty
#

that's to say ?

#

#1000336411876143186 message
I have them there normally 👀

gentle mist
#

you need that intent on in the dev portal as well

lost jetty
#

normally I activated everything on the dev portal

foggy mountain
# lost jetty 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))
lost jetty
#

WoW! unfortunately I do not use the "Cog" ...

plucky timber
#

so start using cogs

lost jetty
#

What more does it bring?

foggy mountain
# lost jetty WoW! unfortunately I do not use the "Cog" ...

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!")```
plucky timber
#

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

lost jetty
lost jetty
foggy mountain
plucky timber
#

wym by ordered code

lost jetty
lost jetty
foggy mountain
plucky timber
lost jetty
#

and thank you for your information ^^

lost jetty
#

From what I understood anyway

lost jetty
lost jetty
foggy mountain
#

In case you have Discordpy installed for some strange reason, uninstall.

fast fossil
#

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

rancid mason
#

just wait some minutes

fast fossil
#

dang

#

ive waited like 15 mins and still

#

nvm i found a fix

tulip karma
frosty bronze
#

Make sure you don’t have multiple instances of your bot running.

tulip karma
frosty bronze
#

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.

tulip karma
tulip karma
#

And I'm certain I only have one of those running lol

frosty bronze
#

Hmm well narrowing it down. It may be helpful to post your relevant code (excluding any tokens or sensitive information)

tulip karma
#

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!")

######################################################################```