using Discord.WebSocket;
namespace Discord.Commands
{
/// The sharded variant of , which may contain the client, user, guild, channel, and message.
public class ShardedCommandContext : SocketCommandContext, ICommandContext
{
/// Gets the that the command is executed with.
public new DiscordShardedClient Client { get; }
public ShardedCommandContext(DiscordShardedClient client, SocketUserMessage msg)
: base(client.GetShard(GetShardId(client, (msg.Channel as SocketGuildChannel)?.Guild)), msg)
{
Client = client;
}
/// Gets the shard ID of the command context.
private static int GetShardId(DiscordShardedClient client, IGuild guild)
=> guild == null ? 0 : client.GetShardIdFor(guild);
//ICommandContext
///
IDiscordClient ICommandContext.Client => Client;
}
}