#Trying to Bulk sync all my commands.

1 messages · Page 1 of 1 (latest)

orchid fractal
#

You shouldn't be getting ratelimited in the first place

#

If you're getting ratelimited, you're doing something wrong

#

You have too many commands and you're starting the bot too many times

#

You won't be able to sync a command if you're ratelimited

#

1 or 200, if you're ratelimited the api will just reject you

dreamy warren
#

thats what i am attempting to figure out, wdym too many commands?, ive seen bots with way more commands.

orchid fractal
#

That's how ratelimits work

orchid fractal
#

If you constantly run and stop the bot, you're syncing commands constantly

dreamy warren
#

So i am likely docked for the day.

orchid fractal
#

And that gets you ratelimited

#

The error should tell you

dreamy warren
#

all i am told is i got 320 ish sec ratelimited.

orchid fractal
#

Show the error

dreamy warren
# orchid fractal Show the error

WARNING:http:333:discord.http: We are being rate limited. Retrying in 432seconds. Handled under the bucket "None:None:/applications/{application_id}/commands"

#

Discord bot creation is something i just jumped headfirst into, so i am still getting attempting to get the hang of this.

orchid fractal
#

Doesn't look like the daily ratelimit

#

Well you still got ratelimited for other reason

dreamy warren
#

i have restarted my bot around 24 times today to debug and test.

#

that might be the issue.

orchid fractal
#

@mint ginkgo could tell what it exactly is

dreamy warren
#

i actually dont really know how to actually properly register my command with my dev server, cant figure out head or tails on the pycord docs

orchid fractal
#

The library syncs the commands for you

#

on_connect calls bot.sync_commands

#

You don't have do do anything

#

If you want to quickly register slash cmds in your dev server for testing, you can pass debug_guilds to the bot init which is a list of ints

dreamy warren
#

i don't suppose you have some samplecode i can fiddle with?, like an old blank piece of code i can test to get the hang of it?

orchid fractal
#

You can try just a normal bot

#

bot = discord.Bot(debug_guilds=[12345])

@bot.command()
async def hello(ctx)
       await ctx.respond("Hello")

bot.run("...")```
dreamy warren
#

this is / command right?

#

i've been doing

import json
import os

class CharacterCreation(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.slash_command(name="Testchar", description="Create a new character")
    async def character_creation(self, ctx, picture_url: str, first_name: str, last_name: str, age: int, race: str, description: str, backstory: str):
        await ctx.defer(ephemeral=True) 
folder_path = f"./bot/commands/characters/storage/{ctx.author.id}"
        os.makedirs(folder_path, exist_ok=True)

        # Save character info
        character_info = {
            "picture_url": picture_url,
            "first_name": first_name,
            "last_name": last_name,
            "age": age,
            "race": race,
            "description": description,
            "backstory": backstory,
        }
        with open(f"{folder_path}/{first_name}.json", "w") as f:
            json.dump(character_info, f)

        await ctx.followup.send(f"Character {first_name} {last_name} created successfully.", ephemeral=True)  # Only visible to the user

def setup(bot):
    bot.add_cog(CharacterCreation(bot))```
orchid fractal
#

Looks good to me

dreamy warren
#

idk where i am going wrong then because none of my commands are syncing.

dreamy warren
#

Issue has been fixed after i fed it to GPT 4 as well as CI