#Some slash commands show up on my alt, but some dont.

1 messages · Page 1 of 1 (latest)

wild wharf
#
import nextcord
from nextcord.ext import commands
import apikeys
import aiohttp
import os

intents = nextcord.Intents.default()
intents.message_content = True
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents)

@bot.event
async def on_ready():
    await bot.sync_all_application_commands()
    await bot.change_presence(status=nextcord.Status.do_not_disturb)
    

    print(f"Logged in as {bot.user}")
    print("The bot is now ready for use!")
    print("-----------------------------")

@bot.slash_command(name="shutdown", description="Shuts down the bot.")
async def shutdown(interaction: nextcord.Interaction):
    await interaction.send("Shutting down bot...")
    await bot.close()
    await aiohttp.ClientSession().close()

initial_extension = []

for filename in os.listdir('./cogs'):
    if filename.endswith('.py'):
        initial_extension.append("cogs."+ filename[:-3])
        
if __name__ == "__main__":
    for extension in initial_extension:
        bot.load_extension(extension)

bot.run(apikeys.bot_token)```
#

For some reason, role_remove shows up, but role_add does not show up, even tho they are the exact same code!

charred creek
#

looks like your indentation is wrong

wild wharf
#

Whats wrong?

charred creek
#

too much spaces

#

it should be 4 less

wild wharf
#

Oh

#

wait let me try

charred creek
#

its not the same as remove_role.error

#

compare it yourself

wild wharf
#

purge also had wrong identation but that one does show up

charred creek
#

i dont even understand how could your code run if there was wrong indentation..

#

are u even saving your files?

wild wharf
#

yeah of

#

ofc

wild wharf
soft pasture
wild wharf
#

1 thing tho when i have administrator perms all commands show up

wild wharf
charred creek
#
  1. dont put await bot.sync_all_application_commands() in on_ready. again, nextcord syncs commands automatically on startup.
    1.1. because you did put in there, and if you restarted bot couple of times, you could hit ratelimit, as external usage of that function is not recommended.
#

rn just remove await bot.sync_all_application_commands() from on_ready, wait 5-10 minutes, restart your bot and refresh your discord client

#

should show up

wild wharf
#

@charred creek its fixed

charred creek
wild wharf
#

it turned out that i had overrides enabled inside my server integration settings

charred creek
wild wharf
#

i turned all overrides off and now they show up

wild wharf
charred creek
# wild wharf Okay

even better solution is to pass guild_ids inside of your commands while you are developing them

#

and then when you are ready to deploy your bot to production, remove guild_ids from command

wild wharf
#

Wait what would that do?

charred creek
astral belfry