Port more things!
This commit is contained in:
@@ -33,8 +33,11 @@ namespace Myriad.Rest
|
||||
public Task<Message?> GetMessage(ulong channelId, ulong messageId) =>
|
||||
_client.Get<Message>($"/channels/{channelId}/messages/{messageId}", ("GetMessage", channelId));
|
||||
|
||||
public Task<Channel?> GetGuild(ulong id) =>
|
||||
_client.Get<Channel>($"/guilds/{id}", ("GetGuild", id));
|
||||
public Task<Guild?> GetGuild(ulong id) =>
|
||||
_client.Get<Guild>($"/guilds/{id}", ("GetGuild", id));
|
||||
|
||||
public Task<Channel[]> GetGuildChannels(ulong id) =>
|
||||
_client.Get<Channel[]>($"/guilds/{id}/channels", ("GetGuildChannels", id))!;
|
||||
|
||||
public Task<User?> GetUser(ulong id) =>
|
||||
_client.Get<User>($"/users/{id}", ("GetUser", default));
|
||||
|
@@ -77,8 +77,8 @@ namespace Myriad.Rest.Ratelimit
|
||||
var headerNextReset = DateTimeOffset.UtcNow + headers.ResetAfter.Value; // todo: server time
|
||||
if (headerNextReset > _nextReset)
|
||||
{
|
||||
_logger.Debug("{BucketKey}/{BucketMajor}: Received reset time {NextReset} from server",
|
||||
Key, Major, _nextReset);
|
||||
_logger.Debug("{BucketKey}/{BucketMajor}: Received reset time {NextReset} from server (after: {NextResetAfter})",
|
||||
Key, Major, headerNextReset, headers.ResetAfter.Value);
|
||||
|
||||
_nextReset = headerNextReset;
|
||||
_resetTimeValid = true;
|
||||
@@ -101,7 +101,7 @@ namespace Myriad.Rest.Ratelimit
|
||||
_semaphore.Wait();
|
||||
|
||||
// If we're past the reset time *and* we haven't reset already, do that
|
||||
var timeSinceReset = _nextReset - now;
|
||||
var timeSinceReset = now - _nextReset;
|
||||
var shouldReset = _resetTimeValid && timeSinceReset > TimeSpan.Zero;
|
||||
if (shouldReset)
|
||||
{
|
||||
|
@@ -1,10 +1,22 @@
|
||||
using Myriad.Types;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using Myriad.Types;
|
||||
using Myriad.Utils;
|
||||
|
||||
namespace Myriad.Rest.Types.Requests
|
||||
{
|
||||
public record MessageEditRequest
|
||||
{
|
||||
public string? Content { get; set; }
|
||||
public Embed? Embed { get; set; }
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public Optional<string?> Content { get; init; }
|
||||
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public Optional<Embed?> Embed { get; init; }
|
||||
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public Optional<Message.MessageFlags> Flags { get; init; }
|
||||
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public Optional<AllowedMentions> AllowedMentions { get; init; }
|
||||
}
|
||||
}
|
@@ -7,7 +7,7 @@ namespace Myriad.Rest.Types.Requests
|
||||
public string? Content { get; set; }
|
||||
public object? Nonce { get; set; }
|
||||
public bool Tts { get; set; }
|
||||
public AllowedMentions AllowedMentions { get; set; }
|
||||
public AllowedMentions? AllowedMentions { get; set; }
|
||||
public Embed? Embed { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user