Discord Bot Not Logging In!
See original GitHub issueSo just opened a new project and installed Discord.Net so I could create a Discord bot.
But when I ran the program it fires the loggedIn event like normal but the bot is offline and its not responding to commands.
I then use the log event to see whether it was connecting to Discords gateway but no, it just tells me the API version and that’s it.
Here’s my code:
static void Main(string[] args)
{
new Thread(async () =>
{
client.LoggedIn += OnLoggedIn;
client.MessageReceived += OnMessageReceive;
client.Log += Client_Log;
await client.LoginAsync(TokenType.Bot, token);
}).Start();
Thread.Sleep(-1);
}
private static Task Client_Log(LogMessage arg)
{
Console.WriteLine(arg);
return Task.CompletedTask;
}
static DiscordSocketClient client = new DiscordSocketClient();
static string token = "My token goes here.";
private static Task OnLoggedIn()
{
Console.WriteLine("logged in.");
return Task.CompletedTask;
}
private static Task OnMessageReceive(SocketMessage arg)
{
Console.WriteLine(arg.Content);
return Task.CompletedTask;
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:13
Top Results From Across the Web
Discord.js bot not logging in
It's looking like about the intents and there's simple mistake as i've seen. If you wan't to open all intents i recommend you...
Read more >Discord bot does not connect with no error messages
My Discord bot (~acolyte-bot) won't login to the discord API. I'm using Discord.js. I have tried: curl -I https://discordapp.com/api/v7/ ...
Read more >Discord.js bot will not login to client user
So I have a Discord bot, and it's been working just fine. I've had it running for 28 days now, and it's done...
Read more >Why Are Discord Bots Not Working?
Discord bots may not work for various reasons, such as server issues, hosting problems, code errors, permission issues, or outdated files.
Read more >Bot unable to login for 24hrs · Issue #5315 · discordjs ...
I'm the owner of a fairly large (~7k guilds) bot using discord.js. I have been using discord.js in production for over a year...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it is a library problem!! its still not logging in. and ive made a bot with discord.net before
You are missing
As mentioned in Start making a bot
I would recommend you to use
await Task.Delay(-1);
as mentioned by @erxkk