Discord API migration has broke it
Closed this issue · 8 comments
Deleted user commented
Discord API migration has broke it
jlnpinheiro commented
Whats happening?
Haapavuo commented
The server responded with error 400: BadRequest
jlnpinheiro commented
Did you try this @Haapavuo ? 👇
using JNogueira.Discord.Webhook.Client;
// Create an instance of the class DiscordWebhookClient with your Discord webhook URL.
var client = new DiscordWebhookClient("Your Discord webhook URL herer!");
// Create your DiscordMessage with all parameters of your message.
var message = new DiscordMessage(
"Discord Webhook Client sent this message! " + DiscordEmoji.Grinning,
username: "Username",
avatarUrl: "https://avatars3.githubusercontent.com/u/24236993?s=460&v=4",
tts: false,
embeds: new[]
{
new DiscordMessageEmbed(
"Embed title " + DiscordEmoji.Thumbsup,
color: 0,
author: new DiscordMessageEmbedAuthor("Embed 1 author name"),
url: "https://github.com/jlnpinheiro/discord-webhook-client/",
description: "This is a embed description.",
fields: new[]
{
new DiscordMessageEmbedField("Field 1 name", "Field 1 value"),
new DiscordMessageEmbedField("Field 2 name", "Field 2 value")
},
thumbnail: new DiscordMessageEmbedThumbnail("https://avatars3.githubusercontent.com/u/24236993?s=460&v=4"),
image: new DiscordMessageEmbedImage("https://avatars3.githubusercontent.com/u/24236993?s=460&v=4"),
footer: new DiscordMessageEmbedFooter("This is a embed footer text", "https://avatars3.githubusercontent.com/u/24236993?s=460&v=4")
)
}
);
// Send the message!
await _client.SendToDiscord(message);```
Haapavuo commented
I have a code that was working previously but now doesn't work. I haven't change anything so I believe the Discord API has changed?
jlnpinheiro commented
The Discord API does not appear to have been modified. Look at this @Haapavuo: https://discord.com/developers/docs/resources/webhook
Haapavuo commented
You are correct. The problem for me was that there was too many or too large embeds. The error message doesn't tell you that though. But everything works now if I reduce embed count or size.
sneakerstadt commented
jlnpinheiro commented
@sneakerstadt the message field is required. I don't understand your question very well! Can you give me more details?