Skip to content
Advertisement

My discord bot not updating status when it joins a new server

My bot not updating when someone invites my bot to their/another server. I have to restart the code, then it is working. I want that my bot updated when someone invites in status.

My current code is:

PREFIX = <

JavaScript

Advertisement

Answer

It seems you want to update the bot’s status whenever your bot joins a new server. Instead of using an unnecessary setInterval to check the cached guild size every X seconds, you could use the guildCreate event.

It emits whenever the client joins a guild, so whenever it fires, you can update the activity inside its callback:

JavaScript

PS: your client needs the GUILDS intent to be enabled

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement