using CSharpDiscordWebhook.Objects; using System.Drawing; using System.Runtime.InteropServices; using RadicadeServer.RecNet.Rooms; namespace RadicadeServer.Radicade.Discord.Templates { public class WebhookRoomUpload : IWebhookTemplate { public static async Task Send(string image, string username, string displayName, string profileImage, string roomName, bool republish = false, string description = "None.") { await RadicadeWebhook.SendMessage(Construct(image, username, displayName, profileImage, roomName, republish, description)); } public static MessageBuilder Construct(string image, string username, string displayName, string profileImage, string roomName, bool republish = false, string description = "None.") { return new MessageBuilder { Embeds = [ new EmbedBuilder { Author = new EmbedAuthorBuilder { Name = $"@{username}", IconUrl = profileImage + "?width=256&cropSquare=1" }, Color = Color.Aqua, Description = !republish ? $"{displayName} just published **{roomName}**!" : $"{displayName} just republished **{roomName}**!", Title = !republish ? $"New room published by {displayName}!" : $"Room republished by {displayName}!", Image = new EmbedMediaBuilder { Url = image + "?width=768", Width = 768 }, Fields = [ new EmbedFieldBuilder { Inline = false, Name = "Description", Value = description } ] } ] }; } } }