using shards to see if it fixes connection issues

This commit is contained in:
2023-02-15 21:47:26 -03:00
parent 9be2ffc54a
commit 00022c1cb9
5 changed files with 15 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ namespace TextCommandFramework.Services
public class CommandHandlingService
{
private readonly CommandService _commands;
private readonly DiscordSocketClient _discord;
private readonly DiscordShardedClient _discord;
private readonly IServiceProvider _services;
private readonly string CommandPrefix = "!";
@@ -20,7 +20,7 @@ namespace TextCommandFramework.Services
public CommandHandlingService(IServiceProvider services)
{
_commands = services.GetRequiredService<CommandService>();
_discord = services.GetRequiredService<DiscordSocketClient>();
_discord = services.GetRequiredService<DiscordShardedClient>();
_services = services;
_commands.CommandExecuted += CommandExecutedAsync;
@@ -46,7 +46,7 @@ namespace TextCommandFramework.Services
//Check if the message sent has the specified prefix
if (!message.HasStringPrefix(CommandPrefix, ref argPos)) return;
var context = new SocketCommandContext(_discord, message);
var context = new ShardedCommandContext(_discord, message);
await _commands.ExecuteAsync(context, argPos, _services);
}

View File

@@ -25,7 +25,8 @@ namespace Kasbot.Services
IAudioClient audioClient = await channel.ConnectAsync();
audioClient.Disconnected += (ex) => Stop(Context.Guild.Id);
audioClient.StreamDestroyed += (ex) => Stop(Context.Guild.Id);
conn.AudioClient = audioClient;
if (Clients.ContainsKey(Context.Guild.Id))