Ever since I made my discord bot I get the same error over and over again, no matter what I do in the code! I get this error message when I use httpclien/webclient and I get it even when I don't use it!
Quote:
SSL connection could not be established, see inner exception
Authentication failed, see inner exception. System.Private.CoreLib
The the message received was unexpected or badly formatted
I have no idea what causes this problem and I couldn't find anything about this error in particular.
[Command("avatar")]
public async Task Avatar(SocketGuildUser mention = null)
{
try
{
if (mention is null)
{
string url = Context.User.GetAvatarUrl(format: ImageFormat.Auto,2048).ToString();
EmbedBuilder builder = new EmbedBuilder();
builder.WithTitle("Here you go!").WithImageUrl($"{url}");
await ReplyAsync($"", false, builder.Build());
}
else
{
string url = mention.GetAvatarUrl(format: ImageFormat.Auto, 2048).ToString();
EmbedBuilder builder = new EmbedBuilder();
builder.WithTitle("Here you go!").WithImageUrl($"{url}");
await ReplyAsync($"", false, builder.Build());
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
if (ex.InnerException != null)
{
Console.WriteLine(ex.InnerException.Message + " " + ex.InnerException.Source);
}
if (ex.InnerException.InnerException.Message != null)
{
Console.WriteLine(ex.InnerException.InnerException.Message);
}
}
}
And even with this simple code I got the error message twice and I really do not see what's wrong.
What I have tried:
I tried using http client authentication but the error still remains.
And it's completely random, like 1-3 time out of 20 it happens but the other times it's completely fine and works just as you'd expect