To add an in-app editor to your Discord webhook C# console application, we can create a simple text-based interface where users can input and edit the embed content interactively. Below is an updated version of the C# console app that includes a basic editor. Users can modify the embed fields (title, description, footer, etc.) before sending the webhook.
csharp
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace DiscordWebhookEditor
{
class Program
{
static async Task Main(string[] args)
{
// Initialize embed with default values
var embed = new Embed
{
Title = "Your title here",
Description = "**First Section:**\n" +
"- Item A\n" +
"- Item B\n" +
"- Item C\n\n" +
"**Second Section:**\n" +
"- Item D\n" +
"- Item E\n",
Color = 0x2F3136,
Footer = new Footer { Text = "Footer text • More text" },
Thumbnail = new Thumbnail { Url = "https://your-logo-link.com/logo.png" }
};
// Edit embed fields
embed = EditEmbed(embed);
// 1️⃣ REPLACE with your real Discord webhook URL
const string WEBHOOK_URL = "https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN";
// 2️⃣ OPTIONAL: change username / avatar shown in Discord
var payload = new
{
username = "Bot display name",
avatar_url = "https://your-logo-link.com/logo.png",
embeds = new[] { embed }
};
// Serialize to JSON
var json = JsonSerializer.Serialize(payload);
// Send request
using var http = new HttpClient();
var response = await http.PostAsync(
WEBHOOK_URL,
new StringContent(json, Encoding.UTF8, "application/json")
);
// Result
if (response.IsSuccessStatusCode)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("✅ Embed sent successfully.");
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"❌ Failed to send embed ({(int)response.StatusCode})");
Console.ResetColor();
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}
static Embed EditEmbed(Embed embed)
{
Console.WriteLine("🖋️ Edit your Discord embed:");
while (true)
{
Console.WriteLine($"\nCurrent Embed:");
Console.WriteLine($"Title: {embed.Title}");
Console.WriteLine($"Description: {embed.Description}");
Console.WriteLine($"Footer: {embed.Footer.Text}");
Console.WriteLine($"Thumbnail URL: {embed.Thumbnail.Url}");
Console.WriteLine($"Color: #{embed.Color:X6}");
Console.WriteLine("\nChoose a field to edit:");
Console.WriteLine("1. Title");
Console.WriteLine("2. Description");
Console.WriteLine("3. Footer");
Console.WriteLine("4. Thumbnail URL");
Console.WriteLine("5. Color");
Console.WriteLine("6. Done editing");
var choice = Console.ReadLine();
switch (choice)
{
case "1":
Console.Write("Enter new title: ");
embed.Title = Console.ReadLine();
break;
case "2":
Console.Write("Enter new description: ");
embed.Description = Console.ReadLine();
break;
case "3":
Console.Write("Enter new footer text: ");
embed.Footer.Text = Console.ReadLine();
break;
case "4":
Console.Write("Enter new thumbnail URL: ");
embed.Thumbnail.Url = Console.ReadLine();
break;
case "5":
Console.Write("Enter new color (hex, e.g., FF0000): ");
if (int.TryParse(Console.ReadLine(), System.Globalization.NumberStyles.HexNumber, null, out int color))
{
embed.Color = color;
}
else
{
Console.WriteLine("Invalid color format!");
}
break;
case "6":
return embed;
default:
Console.WriteLine("Invalid choice. Try again.");
break;
}
}
}
}
class Embed
{
public string Title { get; set; }
public string Description { get; set; }
public int Color { get; set; }
public Footer Footer { get; set; } = new Footer();
public Thumbnail Thumbnail { get; set; } = new Thumbnail();
}
class Footer
{
public string Text { get; set; }
}
class Thumbnail
{
public string Url { get; set; }
}
}
How It Works:
Interactive Editor: The EditEmbed method provides a simple text-based menu to edit the embed fields.
Field Selection: Users can choose which field to edit (title, description, footer, etc.).
Real-Time Updates: Changes are applied immediately and displayed in the preview.
Send Webhook: Once editing is complete, the webhook is sent with the updated embed.
Usage:
Replace YOUR_WEBHOOK_ID and YOUR_WEBHOOK_TOKEN with your actual Discord webhook details.
Run the app and follow the on-screen instructions to edit the embed fields.
Once done, the app will send the embed to Discord.