run dotnet format

This commit is contained in:
spiral 2021-08-27 11:03:47 -04:00
parent 05989242f9
commit ac2671452d
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31
278 changed files with 1913 additions and 1808 deletions

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Myriad.Types;
@ -11,31 +11,32 @@ namespace Myriad.Builders
public EmbedBuilder Title(string? title)
{
_embed = _embed with {Title = title};
_embed = _embed with { Title = title };
return this;
}
public EmbedBuilder Description(string? description)
{
_embed = _embed with { Description = description};
_embed = _embed with { Description = description };
return this;
}
public EmbedBuilder Url(string? url)
{
_embed = _embed with {Url = url};
_embed = _embed with { Url = url };
return this;
}
public EmbedBuilder Color(uint? color)
{
_embed = _embed with {Color = color};
_embed = _embed with { Color = color };
return this;
}
public EmbedBuilder Footer(Embed.EmbedFooter? footer)
{
_embed = _embed with {
_embed = _embed with
{
Footer = footer
};
return this;
@ -43,7 +44,8 @@ namespace Myriad.Builders
public EmbedBuilder Image(Embed.EmbedImage? image)
{
_embed = _embed with {
_embed = _embed with
{
Image = image
};
return this;
@ -52,7 +54,8 @@ namespace Myriad.Builders
public EmbedBuilder Thumbnail(Embed.EmbedThumbnail? thumbnail)
{
_embed = _embed with {
_embed = _embed with
{
Thumbnail = thumbnail
};
return this;
@ -60,7 +63,8 @@ namespace Myriad.Builders
public EmbedBuilder Author(Embed.EmbedAuthor? author)
{
_embed = _embed with {
_embed = _embed with
{
Author = author
};
return this;
@ -68,7 +72,8 @@ namespace Myriad.Builders
public EmbedBuilder Timestamp(string? timestamp)
{
_embed = _embed with {
_embed = _embed with
{
Timestamp = timestamp
};
return this;

View File

@ -1,4 +1,4 @@
using System.Threading.Tasks;
using System.Threading.Tasks;
using Myriad.Gateway;

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using Myriad.Types;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
@ -70,9 +70,11 @@ namespace Myriad.Cache
if (!found)
{
_guilds[guildId] = guild with {
Guild = guild.Guild with {
Roles = guild.Guild.Roles.Concat(new[] { role}).ToArray()
_guilds[guildId] = guild with
{
Guild = guild.Guild with
{
Roles = guild.Guild.Roles.Concat(new[] { role }).ToArray()
}
};
}

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using Myriad.Cache;

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Extensions
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Extensions
namespace Myriad.Extensions
{
public static class GuildExtensions
{

View File

@ -1,4 +1,4 @@
using Myriad.Gateway;
using Myriad.Gateway;
using Myriad.Types;
namespace Myriad.Extensions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
using System;
using System;
using Myriad.Types;

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Extensions
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway
namespace Myriad.Gateway
{
public record GuildDeleteEvent(ulong Id, bool Unavailable): IGatewayEvent;
}

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway
namespace Myriad.Gateway
{
public record GuildRoleDeleteEvent(ulong GuildId, ulong RoleId): IGatewayEvent;
}

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
namespace Myriad.Gateway
@ -7,33 +7,33 @@ namespace Myriad.Gateway
{
public static readonly Dictionary<string, Type> EventTypes = new()
{
{"READY", typeof(ReadyEvent)},
{"RESUMED", typeof(ResumedEvent)},
{"GUILD_CREATE", typeof(GuildCreateEvent)},
{"GUILD_UPDATE", typeof(GuildUpdateEvent)},
{"GUILD_DELETE", typeof(GuildDeleteEvent)},
{"GUILD_MEMBER_ADD", typeof(GuildMemberAddEvent)},
{"GUILD_MEMBER_REMOVE", typeof(GuildMemberRemoveEvent)},
{"GUILD_MEMBER_UPDATE", typeof(GuildMemberUpdateEvent)},
{"GUILD_ROLE_CREATE", typeof(GuildRoleCreateEvent)},
{"GUILD_ROLE_UPDATE", typeof(GuildRoleUpdateEvent)},
{"GUILD_ROLE_DELETE", typeof(GuildRoleDeleteEvent)},
{"CHANNEL_CREATE", typeof(ChannelCreateEvent)},
{"CHANNEL_UPDATE", typeof(ChannelUpdateEvent)},
{"CHANNEL_DELETE", typeof(ChannelDeleteEvent)},
{"THREAD_CREATE", typeof(ThreadCreateEvent)},
{"THREAD_UPDATE", typeof(ThreadUpdateEvent)},
{"THREAD_DELETE", typeof(ThreadDeleteEvent)},
{"THREAD_LIST_SYNC", typeof(ThreadListSyncEvent)},
{"MESSAGE_CREATE", typeof(MessageCreateEvent)},
{"MESSAGE_UPDATE", typeof(MessageUpdateEvent)},
{"MESSAGE_DELETE", typeof(MessageDeleteEvent)},
{"MESSAGE_DELETE_BULK", typeof(MessageDeleteBulkEvent)},
{"MESSAGE_REACTION_ADD", typeof(MessageReactionAddEvent)},
{"MESSAGE_REACTION_REMOVE", typeof(MessageReactionRemoveEvent)},
{"MESSAGE_REACTION_REMOVE_ALL", typeof(MessageReactionRemoveAllEvent)},
{"MESSAGE_REACTION_REMOVE_EMOJI", typeof(MessageReactionRemoveEmojiEvent)},
{"INTERACTION_CREATE", typeof(InteractionCreateEvent)}
{ "READY", typeof(ReadyEvent) },
{ "RESUMED", typeof(ResumedEvent) },
{ "GUILD_CREATE", typeof(GuildCreateEvent) },
{ "GUILD_UPDATE", typeof(GuildUpdateEvent) },
{ "GUILD_DELETE", typeof(GuildDeleteEvent) },
{ "GUILD_MEMBER_ADD", typeof(GuildMemberAddEvent) },
{ "GUILD_MEMBER_REMOVE", typeof(GuildMemberRemoveEvent) },
{ "GUILD_MEMBER_UPDATE", typeof(GuildMemberUpdateEvent) },
{ "GUILD_ROLE_CREATE", typeof(GuildRoleCreateEvent) },
{ "GUILD_ROLE_UPDATE", typeof(GuildRoleUpdateEvent) },
{ "GUILD_ROLE_DELETE", typeof(GuildRoleDeleteEvent) },
{ "CHANNEL_CREATE", typeof(ChannelCreateEvent) },
{ "CHANNEL_UPDATE", typeof(ChannelUpdateEvent) },
{ "CHANNEL_DELETE", typeof(ChannelDeleteEvent) },
{ "THREAD_CREATE", typeof(ThreadCreateEvent) },
{ "THREAD_UPDATE", typeof(ThreadUpdateEvent) },
{ "THREAD_DELETE", typeof(ThreadDeleteEvent) },
{ "THREAD_LIST_SYNC", typeof(ThreadListSyncEvent) },
{ "MESSAGE_CREATE", typeof(MessageCreateEvent) },
{ "MESSAGE_UPDATE", typeof(MessageUpdateEvent) },
{ "MESSAGE_DELETE", typeof(MessageDeleteEvent) },
{ "MESSAGE_DELETE_BULK", typeof(MessageDeleteBulkEvent) },
{ "MESSAGE_REACTION_ADD", typeof(MessageReactionAddEvent) },
{ "MESSAGE_REACTION_REMOVE", typeof(MessageReactionRemoveEvent) },
{ "MESSAGE_REACTION_REMOVE_ALL", typeof(MessageReactionRemoveAllEvent) },
{ "MESSAGE_REACTION_REMOVE_EMOJI", typeof(MessageReactionRemoveEmojiEvent) },
{ "INTERACTION_CREATE", typeof(InteractionCreateEvent) }
};
}
}

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway
namespace Myriad.Gateway
{
public record MessageDeleteBulkEvent(ulong[] Ids, ulong ChannelId, ulong? GuildId): IGatewayEvent;
}

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway
namespace Myriad.Gateway
{
public record MessageDeleteEvent(ulong Id, ulong ChannelId, ulong? GuildId): IGatewayEvent;
}

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway
namespace Myriad.Gateway
{
public record MessageReactionRemoveAllEvent(ulong ChannelId, ulong MessageId, ulong? GuildId): IGatewayEvent;
}

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
using Myriad.Utils;
namespace Myriad.Gateway

View File

@ -1,4 +1,4 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Myriad.Types;

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway
namespace Myriad.Gateway
{
public record ResumedEvent: IGatewayEvent;
}

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Gateway
{

View File

@ -1,11 +1,11 @@
using System;
using System;
namespace Myriad.Gateway
{
// TODO: unused?
public class GatewayCloseException: Exception
{
public GatewayCloseException(int closeCode, string closeReason): base($"{closeCode}: {closeReason}")
public GatewayCloseException(int closeCode, string closeReason) : base($"{closeCode}: {closeReason}")
{
CloseCode = closeCode;
CloseReason = closeReason;

View File

@ -1,4 +1,4 @@
using System;
using System;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Myriad.Gateway
{
@ -7,10 +7,12 @@ namespace Myriad.Gateway
[JsonPropertyName("op")] public GatewayOpcode Opcode { get; init; }
[JsonPropertyName("d")] public object? Payload { get; init; }
[JsonPropertyName("s")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("s")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public int? Sequence { get; init; }
[JsonPropertyName("t")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("t")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? EventType { get; init; }
}

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway
namespace Myriad.Gateway
{
public record GatewaySettings
{

View File

@ -1,4 +1,4 @@
using System.Threading.Tasks;
using System.Threading.Tasks;
namespace Myriad.Gateway.Limit
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Net.Http;
using System.Threading.Tasks;

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway
namespace Myriad.Gateway
{
public record GatewayHello(int HeartbeatInterval);
}

View File

@ -1,4 +1,4 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace Myriad.Gateway
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway
namespace Myriad.Gateway
{
public record GatewayResume(string Token, string SessionId, int Seq);
}

View File

@ -1,4 +1,4 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Myriad.Serialization;
using Myriad.Types;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Net.WebSockets;
using System.Text.Json;
using System.Threading.Tasks;
@ -187,7 +187,7 @@ namespace Myriad.Gateway
private async Task SendHeartbeat(int? lastSeq)
{
await _conn.Send(new GatewayPacket {Opcode = GatewayOpcode.Heartbeat, Payload = lastSeq});
await _conn.Send(new GatewayPacket { Opcode = GatewayOpcode.Heartbeat, Payload = lastSeq });
}
private async Task Reconnect(WebSocketCloseStatus closeStatus, TimeSpan delay)

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Net.WebSockets;
using System.Text.Json;
using System.Threading;
@ -40,7 +40,7 @@ namespace Myriad.Gateway
public async Task Send(GatewayPacket packet)
{
// from `ManagedWebSocket.s_validSendStates`
if (_client is not {State: WebSocketState.Open or WebSocketState.CloseReceived})
if (_client is not { State: WebSocketState.Open or WebSocketState.CloseReceived })
return;
try
@ -62,7 +62,7 @@ namespace Myriad.Gateway
public async Task<GatewayPacket?> Read()
{
// from `ManagedWebSocket.s_validReceiveStates`
if (_client is not {State: WebSocketState.Open or WebSocketState.CloseSent})
if (_client is not { State: WebSocketState.Open or WebSocketState.CloseSent })
return null;
try

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway
namespace Myriad.Gateway
{
public record ShardInfo(int ShardId, int NumShards);
}

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Buffers;
using System.IO;
using System.Net.WebSockets;
@ -51,7 +51,7 @@ namespace Myriad.Gateway
stream.Write(buf.Memory.Span.Slice(0, res.Count));
}
return DeserializeObject(res, stream.GetBuffer().AsSpan(0, (int) stream.Length));
return DeserializeObject(res, stream.GetBuffer().AsSpan(0, (int)stream.Length));
}
private (WebSocketMessageType type, GatewayPacket packet) DeserializeSingleBuffer(

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading;
using System.Threading.Tasks;

View File

@ -1,4 +1,4 @@
namespace Myriad.Gateway.State
namespace Myriad.Gateway.State
{
public enum ShardState
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Net.WebSockets;
using System.Text.Json;
using System.Threading.Tasks;
@ -92,7 +92,7 @@ namespace Myriad.Gateway
case GatewayOpcode.Dispatch:
_lastSeq = packet.Sequence;
var evt = DeserializeEvent(packet.EventType!, (JsonElement) packet.Payload!);
var evt = DeserializeEvent(packet.EventType!, (JsonElement)packet.Payload!);
if (evt != null)
{
if (evt is ReadyEvent ready)
@ -218,7 +218,7 @@ namespace Myriad.Gateway
private T DeserializePayload<T>(GatewayPacket packet)
{
var packetPayload = (JsonElement) packet.Payload!;
var packetPayload = (JsonElement)packet.Payload!;
return JsonSerializer.Deserialize<T>(packetPayload.GetRawText(), _jsonSerializerOptions)!;
}

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
@ -52,7 +52,7 @@ namespace Myriad.Rest
var waitPolicy = Policy
.Handle<RatelimitBucketExhaustedException>()
.WaitAndRetryAsync(3,
(_, e, _) => ((RatelimitBucketExhaustedException) e).RetryAfter,
(_, e, _) => ((RatelimitBucketExhaustedException)e).RetryAfter,
(_, _, _, _) => Task.CompletedTask)
.AsAsyncPolicy<HttpResponseMessage>();
@ -68,7 +68,7 @@ namespace Myriad.Rest
return default;
}
public async Task<T?> Get<T>(string path, (string endpointName, ulong major) ratelimitParams) where T: class
public async Task<T?> Get<T>(string path, (string endpointName, ulong major) ratelimitParams) where T : class
{
using var response = await Send(() => new HttpRequestMessage(HttpMethod.Get, ApiBaseUrl + path),
ratelimitParams, true);
@ -81,7 +81,7 @@ namespace Myriad.Rest
}
public async Task<T?> Post<T>(string path, (string endpointName, ulong major) ratelimitParams, object? body)
where T: class
where T : class
{
using var response = await Send(() =>
{
@ -93,7 +93,7 @@ namespace Myriad.Rest
}
public async Task<T?> PostMultipart<T>(string path, (string endpointName, ulong major) ratelimitParams, object? payload, MultipartFile[]? files)
where T: class
where T : class
{
using var response = await Send(() =>
{
@ -105,7 +105,7 @@ namespace Myriad.Rest
}
public async Task<T?> Patch<T>(string path, (string endpointName, ulong major) ratelimitParams, object? body)
where T: class
where T : class
{
using var response = await Send(() =>
{
@ -117,7 +117,7 @@ namespace Myriad.Rest
}
public async Task<T?> Put<T>(string path, (string endpointName, ulong major) ratelimitParams, object? body)
where T: class
where T : class
{
using var response = await Send(() =>
{
@ -160,7 +160,7 @@ namespace Myriad.Rest
request.Content = mfd;
}
private async Task<T?> ReadResponse<T>(HttpResponseMessage response) where T: class
private async Task<T?> ReadResponse<T>(HttpResponseMessage response) where T : class
{
if (response.StatusCode == HttpStatusCode.NoContent)
return null;
@ -189,7 +189,7 @@ namespace Myriad.Rest
_logger.Debug(
"Response: {RequestMethod} {RequestPath} -> {StatusCode} {ReasonPhrase} (in {ResponseDurationMs} ms)",
request.Method, request.RequestUri, (int) response.StatusCode, response.ReasonPhrase, stopwatch.ElapsedMilliseconds);
request.Method, request.RequestUri, (int)response.StatusCode, response.ReasonPhrase, stopwatch.ElapsedMilliseconds);
await HandleApiError(response, ignoreNotFound);

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Net;
using System.Threading.Tasks;

View File

@ -1,4 +1,4 @@
using System.Text.Json;
using System.Text.Json;
namespace Myriad.Rest
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Net;
using System.Net.Http;
@ -29,43 +29,49 @@ namespace Myriad.Rest.Exceptions
public class NotFoundException: DiscordRequestException
{
public NotFoundException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError): base(
response, responseBody, apiError) { }
public NotFoundException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError) : base(
response, responseBody, apiError)
{ }
}
public class UnauthorizedException: DiscordRequestException
{
public UnauthorizedException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError): base(
response, responseBody, apiError) { }
public UnauthorizedException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError) : base(
response, responseBody, apiError)
{ }
}
public class ForbiddenException: DiscordRequestException
{
public ForbiddenException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError): base(
response, responseBody, apiError) { }
public ForbiddenException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError) : base(
response, responseBody, apiError)
{ }
}
public class ConflictException: DiscordRequestException
{
public ConflictException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError): base(
response, responseBody, apiError) { }
public ConflictException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError) : base(
response, responseBody, apiError)
{ }
}
public class BadRequestException: DiscordRequestException
{
public BadRequestException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError): base(
response, responseBody, apiError) { }
public BadRequestException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError) : base(
response, responseBody, apiError)
{ }
}
public class TooManyRequestsException: DiscordRequestException
{
public TooManyRequestsException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError):
base(response, responseBody, apiError) { }
public TooManyRequestsException(HttpResponseMessage response, string responseBody, DiscordApiError? apiError) :
base(response, responseBody, apiError)
{ }
}
public class UnknownDiscordRequestException: DiscordRequestException
{
public UnknownDiscordRequestException(HttpResponseMessage response, string responseBody,
DiscordApiError? apiError): base(response, responseBody, apiError) { }
DiscordApiError? apiError) : base(response, responseBody, apiError) { }
}
}

View File

@ -1,4 +1,4 @@
using System;
using System;
using Myriad.Rest.Ratelimit;
@ -6,12 +6,12 @@ namespace Myriad.Rest.Exceptions
{
public class RatelimitException: Exception
{
public RatelimitException(string? message): base(message) { }
public RatelimitException(string? message) : base(message) { }
}
public class RatelimitBucketExhaustedException: RatelimitException
{
public RatelimitBucketExhaustedException(Bucket bucket, TimeSpan retryAfter): base(
public RatelimitBucketExhaustedException(Bucket bucket, TimeSpan retryAfter) : base(
"Rate limit bucket exhausted, request blocked")
{
Bucket = bucket;
@ -24,6 +24,6 @@ namespace Myriad.Rest.Exceptions
public class GloballyRatelimitedException: RatelimitException
{
public GloballyRatelimitedException(): base("Global rate limit hit") { }
public GloballyRatelimitedException() : base("Global rate limit hit") { }
}
}

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Threading;
using Serilog;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Globalization;
using System.Linq;
using System.Net.Http;
@ -41,7 +41,7 @@ namespace Myriad.Rest.Ratelimit
var resetTimestamp = TryGetDouble(response, ResetHeader);
if (resetTimestamp != null)
headers.Reset = DateTimeOffset.FromUnixTimeMilliseconds((long) (resetTimestamp.Value * 1000));
headers.Reset = DateTimeOffset.FromUnixTimeMilliseconds((long)(resetTimestamp.Value * 1000));
var resetAfterSeconds = TryGetDouble(response, ResetAfterHeader);
if (resetAfterSeconds != null)

View File

@ -1,4 +1,4 @@
using System;
using System;
using Myriad.Rest.Exceptions;

View File

@ -1,4 +1,4 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Myriad.Serialization;

View File

@ -1,4 +1,4 @@
using System.IO;
using System.IO;
namespace Myriad.Rest.Types
{

View File

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Myriad.Types;

View File

@ -1,4 +1,4 @@
namespace Myriad.Rest.Types.Requests
namespace Myriad.Rest.Types.Requests
{
public record CreateDmRequest(ulong RecipientId);
}

View File

@ -1,4 +1,4 @@
namespace Myriad.Rest.Types.Requests
namespace Myriad.Rest.Types.Requests
{
public record CreateWebhookRequest(string Name);
}

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Rest.Types.Requests
{

View File

@ -1,4 +1,4 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Myriad.Types;
using Myriad.Utils;

View File

@ -1,4 +1,4 @@
using Myriad.Types;
using Myriad.Types;
namespace Myriad.Rest.Types.Requests
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Rest.Types
namespace Myriad.Rest.Types
{
public record ModifyGuildMemberRequest
{

View File

@ -1,4 +1,4 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Myriad.Utils;

View File

@ -1,4 +1,4 @@
using System.Text.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Myriad.Serialization

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Text;
using System.Text.Json;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Text.Json;
using System.Text.Json.Serialization;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Text.Json;
using System.Text.Json.Serialization;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
@ -26,7 +26,7 @@ namespace Myriad.Serialization
public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options)
{
var innerType = typeToConvert.GetGenericArguments()[0];
return (JsonConverter?) Activator.CreateInstance(
return (JsonConverter?)Activator.CreateInstance(
typeof(Inner<>).MakeGenericType(innerType),
BindingFlags.Instance | BindingFlags.Public,
null,

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
@ -13,12 +13,12 @@ namespace Myriad.Serialization
var str = reader.GetString();
if (str == null) return default;
return (PermissionSet) ulong.Parse(str);
return (PermissionSet)ulong.Parse(str);
}
public override void Write(Utf8JsonWriter writer, PermissionSet value, JsonSerializerOptions options)
{
writer.WriteStringValue(((ulong) value).ToString());
writer.WriteStringValue(((ulong)value).ToString());
}
}
}

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Text.Json;
using System.Text.Json.Serialization;

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record Activity: ActivityPartial
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record Application: ApplicationPartial
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record ApplicationCommand
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record ApplicationCommandInteractionData
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record ApplicationCommandInteractionDataOption
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record ApplicationCommandOption(ApplicationCommandOption.OptionType Type, string Name, string Description)
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record Interaction
{

View File

@ -1,4 +1,4 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
using Myriad.Rest.Types;
using Myriad.Utils;

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record InteractionResponse
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record Channel
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record Embed
{
@ -16,44 +16,44 @@
public EmbedAuthor? Author { get; init; }
public Field[]? Fields { get; init; }
public record EmbedFooter (
public record EmbedFooter(
string Text,
string? IconUrl = null,
string? ProxyIconUrl = null
);
public record EmbedImage (
public record EmbedImage(
string? Url,
uint? Width = null,
uint? Height = null
);
public record EmbedThumbnail (
public record EmbedThumbnail(
string? Url,
string? ProxyUrl = null,
uint? Width = null,
uint? Height = null
);
public record EmbedVideo (
public record EmbedVideo(
string? Url,
uint? Width = null,
uint? Height = null
);
public record EmbedProvider (
public record EmbedProvider(
string? Name,
string? Url
);
public record EmbedAuthor (
public record EmbedAuthor(
string? Name = null,
string? Url = null,
string? IconUrl = null,
string? ProxyIconUrl = null
);
public record Field (
public record Field(
string Name,
string Value,
bool Inline = false

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record Emoji
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record GatewayInfo
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record SessionStartLimit
{

View File

@ -1,4 +1,4 @@
namespace Myriad.Types
namespace Myriad.Types
{
public record Guild
{

Some files were not shown because too many files have changed in this diff Show More