Skip to content

Commit

Permalink
Merge pull request #324 from Octol1ttle/use-extension-fromassembly
Browse files Browse the repository at this point in the history
Use Remora.Discord.Extensions method in LoadRespondersFromAssembly
  • Loading branch information
Nihlus authored Dec 26, 2023
2 parents 195e02b + eff7083 commit 62575ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\Remora.Discord.Extensions\Remora.Discord.Extensions.csproj" />
<ProjectReference Include="..\..\Remora.Discord.Hosting\Remora.Discord.Hosting.csproj" />
</ItemGroup>

Expand Down
12 changes: 2 additions & 10 deletions Samples/LoadRespondersFromAssembly/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
//

using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Remora.Discord.Gateway.Extensions;
using Remora.Discord.Extensions.Extensions;
using Remora.Discord.Hosting.Extensions;

namespace Remora.Discord.Samples.LoadRespondersFromAssembly;
Expand Down Expand Up @@ -52,14 +51,7 @@ private static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefau
(
(_, services) =>
{
var responderTypes = typeof(Program).Assembly
.GetExportedTypes()
.Where(t => t.IsResponder());
foreach (var responderType in responderTypes)
{
services.AddResponder(responderType);
}
services.AddRespondersFromAssembly(typeof(Program).Assembly);
}
)
.ConfigureLogging
Expand Down

0 comments on commit 62575ba

Please sign in to comment.