feat(bot): port message info embeds to cv2
Some checks are pending
Build and push Docker image / .net docker build (push) Waiting to run
.net checks / run .net tests (push) Waiting to run
.net checks / dotnet-format (push) Waiting to run

This commit is contained in:
asleepyskye 2025-10-24 10:23:38 -04:00
parent 14f11bd1e9
commit 83f2d33c3d
7 changed files with 312 additions and 31 deletions

View file

@ -39,6 +39,9 @@ public static class DiscordUtils
public static Instant SnowflakeToInstant(ulong snowflake) =>
Instant.FromUtc(2015, 1, 1, 0, 0, 0) + Duration.FromMilliseconds(snowflake >> 22);
public static ulong SnowflakeToTimestamp(ulong snowflake) =>
((ulong)Instant.FromUtc(2015, 1, 1, 0, 0, 0).ToUnixTimeMilliseconds() + (snowflake >> 22)) / 1000;
public static ulong InstantToSnowflake(Instant time) =>
(ulong)(time - Instant.FromUtc(2015, 1, 1, 0, 0, 0)).TotalMilliseconds << 22;

View file

@ -76,6 +76,16 @@ public class InteractionContext
});
}
public async Task Reply(MessageComponent[] components = null)
{
await Respond(InteractionResponse.ResponseType.ChannelMessageWithSource,
new InteractionApplicationCommandCallbackData
{
Components = components,
Flags = Message.MessageFlags.Ephemeral | Message.MessageFlags.IsComponentsV2
});
}
public async Task Defer()
{
await Respond(InteractionResponse.ResponseType.DeferredChannelMessageWithSource,