Frequently Asked Questions
Why don't you provide light mode for the documentation?
Because light attracts bugs.
Jokes aside, I mainly use dark mode, and I don't want to maintain two versions of the documentation. CSS is painful enough.
What is a snowflake
Discord calls their IDs snowflakes.
A snowflake explanation can be seen in the following image:

What is a gateway
Discord uses a websocket connection to send and receive data. This is called the gateway. The gateway is used to send and receive events, and to send and receive messages.

Code I copied from an article isn't compiling or working as expected. Why?
Please use the code snippets as a reference; don't blindly copy-paste code!
The snippets of code in the articles are meant to serve as examples to help you understand how to use a part of the library.
Although most will compile and work at the time of writing, changes to the library over time can make some snippets obsolete.
Many issues can be resolved with Intellisense by searching for similarly named methods and verifying method parameters.
Connecting to a voice channel with Voice will either hang or throw an exception.
To troubleshoot, please ensure that:
- You are using the latest version of DisCatSharp.
- You have properly enabled Voice with your instance of DiscordClient.
- You are not using Voice in an event handler.
- You have libdave, opus and libsodium available in your target environment.
Why am I getting heartbeat skipped message in my console?
There are two possible reasons:
Connection issue between your bot application and Discord.
Check your internet connection and ensure that the machine your bot is hosted on has a stable internet connection.
If your local network has no issues, the problem could be with either Discord or Cloudflare. In which case, it's out of your control.
Complex, long-running code in an event handler.
Any event handlers that have the potential to run for more than a few seconds could cause a deadlock, and cause several heartbeats to be skipped. Please take a look at our short article on handling exceptions to learn how to avoid this.
Why am I getting a 4XX error and how can I fix it?
| HTTP Error Code | Cause | Resolution |
|---|---|---|
401 |
Invalid token. | Verify your token and make sure no errors were made. The client secret found on the 'general information' tab of your application page is not your token. |
403 |
Not enough permissions. | Verify permissions and ensure your bot account has a role higher than the target user. Administrator permissions do not bypass the role hierarchy. |
404 |
Requested object not found. | This usually means the entity does not exist. You should reattempt then inform your user. |
I cannot modify a specific user or role. Why is this?
In order to modify a user, the highest role of your bot account must be higher than the target user.
Changing the properties of a role requires that your bot account have a role higher than that role.
Does CommandsNext support dependency injection?
It does! Please take a look at our article on the subject.
Basically every module of DisCatSharp supports dependency injection.
Can I use a user token?
Automating a user account is against Discord's Terms of Service and is not supported by DisCatSharp.
How can I set a custom status?
You can use either of the following
- The overload for ConnectAsync(DiscordActivity, UserStatus?, DateTimeOffset?) which accepts a DiscordActivity.
- UpdateStatusAsync(DiscordActivity, UserStatus?, DateTimeOffset?) OR UpdateStatusAsync(DiscordActivity, UserStatus?, DateTimeOffset?) (for the sharded client) at any point after
Readyhas been fired.
Am I able to retrieve a DiscordRole by name?
Yes. Use LINQ on the Roles property of your instance of DiscordGuild and compare against the Name of each DiscordRole.
Why are my events not firing?
This is because in the Discord V8+ API, they require DiscordIntents to be enabled on DiscordConfiguration and the Discord Application Portal. We have an article that covers all that has to be done to set this up.