In the past I have used Discord Webhooks with the enqueue procedure and it worked untill recently. I tried the DiscordMessages plugin and failed. I reverted back with the barebones webrequests but still have an issue.
My code is as follows:
My code is as follows:
public void SendToDiscord(string message)
{
string payload = "{\"content\":\"" + message + "\"}";
webrequest.Enqueue(_configuration.DiscordWebhookURL, payload, (code, response) =>
{
if (code != 200 && code != 204)
{
if (response == null)
{
PrintWarning($"Discord didn't respond. Error Code: {code}");
}
else
{
Puts($"Discord respond with: {response} Payload: {payload}");
}
}
}, this, Core.Libraries.RequestMethod.POST);
} Error Message in console:
[Update Notice] Discord respond: {"message": "Cannot send an empty message", "code": 50006} Payload: {"content":"Test message from Update Notice by Psystec"}My payload is correct and well as my DiscordWebhookURL.
I have created a seperate project to test the Webhook using HttpClient() with the same payload and it worked with no issues.
I do believe the issues is not with the code but with how the webrequst is handled.
Any advice will be appreciated
Kind Regards
Psystec