mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 22:37:54 +00:00
Merge remote-tracking branch 'upstream/main' into rust-command-parser
This commit is contained in:
commit
a29ed2bda0
28 changed files with 446 additions and 193 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using Autofac;
|
|||
using Myriad.Cache;
|
||||
using Myriad.Gateway;
|
||||
using Myriad.Rest;
|
||||
using Myriad.Rest.Types;
|
||||
using Myriad.Types;
|
||||
|
||||
using PluralKit.Core;
|
||||
|
|
@ -76,6 +77,17 @@ public class InteractionContext
|
|||
});
|
||||
}
|
||||
|
||||
public async Task Reply(MessageComponent[] components = null, AllowedMentions? mentions = null)
|
||||
{
|
||||
await Respond(InteractionResponse.ResponseType.ChannelMessageWithSource,
|
||||
new InteractionApplicationCommandCallbackData
|
||||
{
|
||||
Components = components,
|
||||
Flags = Message.MessageFlags.Ephemeral | Message.MessageFlags.IsComponentsV2,
|
||||
AllowedMentions = mentions ?? new AllowedMentions()
|
||||
});
|
||||
}
|
||||
|
||||
public async Task Defer()
|
||||
{
|
||||
await Respond(InteractionResponse.ResponseType.DeferredChannelMessageWithSource,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue