<commit_before>﻿using Discord.WebSocket;

namespace Discord.Commands
{
    public class ShardedCommandContext : ICommandContext
    {
        public DiscordShardedClient Client { get; }
        public SocketGuild Guild { get; }
        public ISocketMessageChannel Channel { get; }
        public SocketUser User { get; }
        public SocketUserMessage Message { get; }

        public bool IsPrivate => Channel is IPrivateChannel;

        public ShardedCommandContext(DiscordShardedClient client, SocketUserMessage msg)
        {
            Client = client;
            Guild = (msg.Channel as SocketGuildChannel)?.Guild;
            Channel = msg.Channel;
            User = msg.Author;
            Message = msg;
        }

        //ICommandContext
        IDiscordClient ICommandContext.Client => Client;
        IGuild ICommandContext.Guild => Guild;
        IMessageChannel ICommandContext.Channel => Channel;
        IUser ICommandContext.User => User;
        IUserMessage ICommandContext.Message => Message;
    }
}<commit_msg>Unify ShardedCommandContext with SocketCommandContext (#739)<commit_after>﻿using Discord.WebSocket;

namespace Discord.Commands
{
    public class ShardedCommandContext : SocketCommandContext, ICommandContext
    {
        public new DiscordShardedClient Client { get; }

        public ShardedCommandContext(DiscordShardedClient client, SocketUserMessage msg)
            : base(client.GetShard(GetShardId(client, (msg.Channel as SocketGuildChannel)?.Guild)), msg)
        {
            Client = client;
        }

        private static int GetShardId(DiscordShardedClient client, IGuild guild)
            => guild == null ? 0 : client.GetShardIdFor(guild);

        //ICommandContext
        IDiscordClient ICommandContext.Client => Client;
    }
}
{'fraction_non_alphanumeric': 0.0747350808700502, 'fraction_numerical': 0.002230897936419409, 'mean_word_length': 2.72972972972973, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3953839', 'n_tokens_mistral': 487, 'n_tokens_neox': 473, 'n_words': 112}