lint: Initial clean-up (#1181)

This commit is contained in:
Still Hsu
2018-10-22 05:26:39 +08:00
committed by Christopher F
parent 5b3eb70ffd
commit 8fa70bf6a6
2 changed files with 10 additions and 5 deletions

View File

@@ -11,9 +11,13 @@ namespace Discord.Commands
{
var executableCommands = new List<CommandInfo>();
var tasks = commands.Select(async c => { var result = await c.CheckPreconditionsAsync(context, provider).ConfigureAwait(false); return new { Command = c, PreconditionResult = result }; });
var tasks = commands.Select(async c =>
{
var result = await c.CheckPreconditionsAsync(context, provider).ConfigureAwait(false);
return new { Command = c, PreconditionResult = result };
});
var results = await Task.WhenAll(tasks);
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
foreach (var result in results)
{
@@ -32,7 +36,7 @@ namespace Discord.Commands
executableCommands.AddRange(await module.Commands.ToArray().GetExecutableCommandsAsync(context, provider).ConfigureAwait(false));
var tasks = module.Submodules.Select(async s => await s.GetExecutableCommandsAsync(context, provider).ConfigureAwait(false));
var results = await Task.WhenAll(tasks);
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
executableCommands.AddRange(results.SelectMany(c => c));

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
@@ -37,8 +38,8 @@ namespace Discord.WebSocket
public IActivity Activity => Presence.Activity;
/// <inheritdoc />
public UserStatus Status => Presence.Status;
public IEnumerable<SocketGuild> MutualGuilds
=> Discord.Guilds.Where(g => g.Users.Any(u => u.Id == Id));
public IReadOnlyCollection<SocketGuild> MutualGuilds
=> Discord.Guilds.Where(g => g.Users.Any(u => u.Id == Id)).ToImmutableArray();
internal SocketUser(DiscordSocketClient discord, ulong id)
: base(discord, id)