Upload files to "/"

This commit is contained in:
2026-07-24 15:42:29 +00:00
parent f305cecd99
commit fcc7f59761
5 changed files with 424 additions and 0 deletions

43
Logs.cs Normal file
View File

@@ -0,0 +1,43 @@
using System.Text;
using System.Text.Json;
namespace Stella
{
public static class Logs
{
private static readonly string webhookUrl = "i'm not that mean";
public static async Task SendWebhookAsync(string imageName, string? uploadedBy, string? roomName)
{
var payload = new
{
content = (string?)null,
embeds = new[]
{
new
{
description = $"Uploaded by @{uploadedBy}\n\nRoom: {roomName}",
color = 16416882,
image = new
{
url = $"https://ns.stellaonline.org/img/{imageName}"
},
timestamp = DateTime.UtcNow.ToString("o")
}
},
attachments = Array.Empty<object>()
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
using HttpClient client = new();
var response = await client.PostAsync(webhookUrl, content);
if (!response.IsSuccessStatusCode)
{
Console.WriteLine($"Failed to send webhook: {response.StatusCode}");
}
}
}
}