Browse Source

Fixes sharded client IF implementation

pull/2205/head
Armano den Boef 3 years ago
parent
commit
3575a53dc9
3 changed files with 8 additions and 5 deletions
  1. +1
    -1
      samples/ShardedClient/Modules/InteractionModule.cs
  2. +5
    -2
      samples/ShardedClient/Program.cs
  3. +2
    -2
      samples/ShardedClient/Services/InteractionHandlingService.cs

+ 1
- 1
samples/ShardedClient/Modules/InteractionModule.cs View File

@@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace ShardedClient.Modules namespace ShardedClient.Modules
{ {
// A display of portability, which shows how minimal the difference between the 2 frameworks is. // A display of portability, which shows how minimal the difference between the 2 frameworks is.
public class InteractionModule : InteractionModuleBase<ShardedInteractionContext<SocketSlashCommand>>
public class InteractionModule : InteractionModuleBase<ShardedInteractionContext>
{ {
[SlashCommand("info", "Information about this shard.")] [SlashCommand("info", "Information about this shard.")]
public async Task InfoAsync() public async Task InfoAsync()


+ 5
- 2
samples/ShardedClient/Program.cs View File

@@ -45,8 +45,11 @@ namespace ShardedClient
client.ShardReady += ReadyAsync; client.ShardReady += ReadyAsync;
client.Log += LogAsync; client.Log += LogAsync;


await services.GetRequiredService<InteractionHandlingService>().InitializeAsync();
await services.GetRequiredService<CommandHandlingService>().InitializeAsync();
await services.GetRequiredService<InteractionHandlingService>()
.InitializeAsync();

await services.GetRequiredService<CommandHandlingService>()
.InitializeAsync();


// Tokens should be considered secret data, and never hard-coded. // Tokens should be considered secret data, and never hard-coded.
await client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("token")); await client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("token"));


+ 2
- 2
samples/ShardedClient/Services/InteractionHandlingService.cs View File

@@ -31,9 +31,9 @@ namespace ShardedClient.Services
{ {
await _service.AddModulesAsync(typeof(InteractionHandlingService).Assembly, _provider); await _service.AddModulesAsync(typeof(InteractionHandlingService).Assembly, _provider);
#if DEBUG #if DEBUG
await _service.AddCommandsToGuildAsync(_client.Guilds.First(x => x.Id == 1));
await _service.RegisterCommandsToGuildAsync(1 /* implement */);
#else #else
await _service.AddCommandsGloballyAsync();
await _service.RegisterCommandsGloballyAsync();
#endif #endif
} }




Loading…
Cancel
Save