Reducing Discord Bot latency

I use nextcord and I want to reduce my discord bot’s latency, How can I do that?

What you mean by latency?

The Voice Client?
The Client itself?
The bot command?

If you can be more specific about what are you trying to achieve and what is the behaviour now, that would be great!

1 Like

The Client itself, It shows that the latency is normally 500ms

1 Like

It can be a lot of things.

Network connection being the first one, any network instability can result in high latency.

Poor code performance (For example, if you have time.sleep() function it can block the execution of your code. If you have long blocking tasks, using asyncio instead can improve latency too.

The hosting location (if your bot is being hosted in another country)

Maybe check if your bot is being rate limited too.
According to the docs you provided, Nextcord provides a method is_ws_ratelimited() which can be useful to understand if the bot is being rate-limited. Being rate-limited can cause additional latency.

Giving additional details can be more usefull to find your problem too (hosting location/environment, if it’s in more than one guild, etc).