Format the project with 'dotnet format' (#2551)

* Sync and Re-Format

* Fix Title string.

* Fix indentation.
This commit is contained in:
NaN
2023-02-13 14:45:59 -03:00
committed by GitHub
parent 71e9ecb21e
commit 257f246d1d
401 changed files with 3178 additions and 2671 deletions

View File

@@ -296,7 +296,7 @@ namespace Discord.Interactions
throw new InvalidOperationException($"{input.GetType().FullName} isn't a valid component info class");
}
if(modifyModal is not null)
if (modifyModal is not null)
modifyModal(builder);
return builder.Build();

View File

@@ -6,6 +6,6 @@ namespace Discord.Interactions
{
public static EmptyServiceProvider Instance => new EmptyServiceProvider();
public object GetService (Type serviceType) => null;
public object GetService(Type serviceType) => null;
}
}

View File

@@ -21,7 +21,7 @@ namespace Discord.Interactions
/// A Task representing the asyncronous waiting operation. If the user responded in the given amount of time, Task result contains the user response,
/// otherwise the Task result is <see langword="null"/>.
/// </returns>
public static async Task<SocketInteraction> WaitForInteractionAsync (BaseSocketClient client, TimeSpan timeout,
public static async Task<SocketInteraction> WaitForInteractionAsync(BaseSocketClient client, TimeSpan timeout,
Predicate<SocketInteraction> predicate, CancellationToken cancellationToken = default)
{
var tcs = new TaskCompletionSource<SocketInteraction>();
@@ -34,7 +34,7 @@ namespace Discord.Interactions
tcs.SetResult(null);
});
cancellationToken.Register(( ) => tcs.SetCanceled());
cancellationToken.Register(() => tcs.SetCanceled());
client.InteractionCreated += HandleInteraction;
var result = await tcs.Task.ConfigureAwait(false);
@@ -42,7 +42,7 @@ namespace Discord.Interactions
return result;
Task HandleInteraction (SocketInteraction interaction)
Task HandleInteraction(SocketInteraction interaction)
{
if (predicate(interaction))
{
@@ -68,7 +68,7 @@ namespace Discord.Interactions
public static Task<SocketInteraction> WaitForMessageComponentAsync(BaseSocketClient client, IUserMessage fromMessage, TimeSpan timeout,
CancellationToken cancellationToken = default)
{
bool Predicate (SocketInteraction interaction) => interaction is SocketMessageComponent component &&
bool Predicate(SocketInteraction interaction) => interaction is SocketMessageComponent component &&
component.Message.Id == fromMessage.Id;
return WaitForInteractionAsync(client, timeout, Predicate, cancellationToken);
@@ -86,7 +86,7 @@ namespace Discord.Interactions
/// A Task representing the asyncronous waiting operation with a <see cref="bool"/> result,
/// the result is <see langword="false"/> if the user declined the prompt or didnt answer in time, <see langword="true"/> if the user confirmed the prompt.
/// </returns>
public static async Task<bool> ConfirmAsync (BaseSocketClient client, IMessageChannel channel, TimeSpan timeout, string message = null,
public static async Task<bool> ConfirmAsync(BaseSocketClient client, IMessageChannel channel, TimeSpan timeout, string message = null,
CancellationToken cancellationToken = default)
{
message ??= "Would you like to continue?";

View File

@@ -10,10 +10,10 @@ namespace Discord.Interactions
internal static class ReflectionUtils<T>
{
private static readonly TypeInfo ObjectTypeInfo = typeof(object).GetTypeInfo();
internal static T CreateObject (TypeInfo typeInfo, InteractionService commandService, IServiceProvider services = null) =>
internal static T CreateObject(TypeInfo typeInfo, InteractionService commandService, IServiceProvider services = null) =>
CreateBuilder(typeInfo, commandService)(services);
internal static Func<IServiceProvider, T> CreateBuilder (TypeInfo typeInfo, InteractionService commandService)
internal static Func<IServiceProvider, T> CreateBuilder(TypeInfo typeInfo, InteractionService commandService)
{
var constructor = GetConstructor(typeInfo);
var parameters = constructor.GetParameters();
@@ -32,7 +32,7 @@ namespace Discord.Interactions
};
}
private static T InvokeConstructor (ConstructorInfo constructor, object[] args, TypeInfo ownerType)
private static T InvokeConstructor(ConstructorInfo constructor, object[] args, TypeInfo ownerType)
{
try
{
@@ -43,7 +43,7 @@ namespace Discord.Interactions
throw new Exception($"Failed to create \"{ownerType.FullName}\".", ex);
}
}
private static ConstructorInfo GetConstructor (TypeInfo ownerType)
private static ConstructorInfo GetConstructor(TypeInfo ownerType)
{
var constructors = ownerType.DeclaredConstructors.Where(x => !x.IsStatic).ToArray();
if (constructors.Length == 0)
@@ -52,7 +52,7 @@ namespace Discord.Interactions
throw new InvalidOperationException($"Multiple constructors found for \"{ownerType.FullName}\".");
return constructors[0];
}
private static PropertyInfo[] GetProperties (TypeInfo ownerType)
private static PropertyInfo[] GetProperties(TypeInfo ownerType)
{
var result = new List<PropertyInfo>();
while (ownerType != ObjectTypeInfo)
@@ -66,7 +66,7 @@ namespace Discord.Interactions
}
return result.ToArray();
}
private static object GetMember (InteractionService commandService, IServiceProvider services, Type memberType, TypeInfo ownerType)
private static object GetMember(InteractionService commandService, IServiceProvider services, Type memberType, TypeInfo ownerType)
{
if (memberType == typeof(InteractionService))
return commandService;
@@ -78,7 +78,7 @@ namespace Discord.Interactions
throw new InvalidOperationException($"Failed to create \"{ownerType.FullName}\", dependency \"{memberType.Name}\" was not found.");
}
internal static Func<T, object[], Task> CreateMethodInvoker (MethodInfo methodInfo)
internal static Func<T, object[], Task> CreateMethodInvoker(MethodInfo methodInfo)
{
var parameters = methodInfo.GetParameters();
var paramsExp = new Expression[parameters.Length];
@@ -105,7 +105,7 @@ namespace Discord.Interactions
/// <summary>
/// Create a type initializer using compiled lambda expressions
/// </summary>
internal static Func<IServiceProvider, T> CreateLambdaBuilder (TypeInfo typeInfo, InteractionService commandService)
internal static Func<IServiceProvider, T> CreateLambdaBuilder(TypeInfo typeInfo, InteractionService commandService)
{
var constructor = GetConstructor(typeInfo);
var parameters = constructor.GetParameters();