diff --git a/src/Discord.Net.Commands/CommandService.cs b/src/Discord.Net.Commands/CommandService.cs index 0c23f79d0..4a9b0476d 100644 --- a/src/Discord.Net.Commands/CommandService.cs +++ b/src/Discord.Net.Commands/CommandService.cs @@ -414,7 +414,7 @@ namespace Discord.Commands /// The position of which the command starts at. /// The result containing the matching commands. public SearchResult Search(ICommandContext context, int argPos) - => Search(context, context.Message.Content.Substring(argPos)); + => Search(context.Message.Content.Substring(argPos)); /// /// Searches for the command. /// @@ -422,6 +422,8 @@ namespace Discord.Commands /// The command string. /// The result containing the matching commands. public SearchResult Search(ICommandContext context, string input) + => Search(input); + public SearchResult Search(string input) { string searchInput = _caseSensitive ? input : input.ToLowerInvariant(); var matches = _map.GetCommands(searchInput).OrderByDescending(x => x.Command.Priority).ToImmutableArray(); @@ -453,7 +455,8 @@ namespace Discord.Commands public async Task ExecuteAsync(ICommandContext context, string input, IServiceProvider services, MultiMatchHandling multiMatchHandling = MultiMatchHandling.Exception) { services = services ?? EmptyServiceProvider.Instance; - var searchResult = Search(context, input); + + var searchResult = Search(input); if (!searchResult.IsSuccess) return searchResult; diff --git a/src/Discord.Net.Core/Discord.Net.Core.csproj b/src/Discord.Net.Core/Discord.Net.Core.csproj index 6a58367e6..d4d450e1c 100644 --- a/src/Discord.Net.Core/Discord.Net.Core.csproj +++ b/src/Discord.Net.Core/Discord.Net.Core.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/Discord.Net.Rest/ClientHelper.cs b/src/Discord.Net.Rest/ClientHelper.cs index 976c2b773..2e7f11801 100644 --- a/src/Discord.Net.Rest/ClientHelper.cs +++ b/src/Discord.Net.Rest/ClientHelper.cs @@ -144,9 +144,14 @@ namespace Discord.Rest public static async Task GetGuildUserAsync(BaseDiscordClient client, ulong guildId, ulong id, RequestOptions options) { + var guild = await GetGuildAsync(client, guildId, options).ConfigureAwait(false); + if (guild == null) + return null; + var model = await client.ApiClient.GetGuildMemberAsync(guildId, id, options).ConfigureAwait(false); if (model != null) - return RestGuildUser.Create(client, new RestGuild(client, guildId), model); + return RestGuildUser.Create(client, guild, model); + return null; }