private async Task HandleCommandAsync(SocketMessage messageParam)
        {
            // Don't process the command if it was a system message
            var message = messageParam as SocketUserMessage;

            if (message == null)
            {
                return;
            }

            // Create a number to track where the prefix ends and the command begins
            int argPos = 0;

            // Determine if the message is a command based on the prefix and make sure no bots trigger commands
            if (!(message.HasCharPrefix('!', ref argPos) ||
                  message.HasMentionPrefix(_client.CurrentUser, ref argPos)) ||
                message.Author.IsBot)
            {
                return;
            }

            // Create a WebSocket-based command context based on the message
            var context = new CustomCommandContext(_client, message);

#if !DEBUG
            // We try to lock the channel so that only one Discord Client instance handles the message
            if (!await ResourceLock.AcquireLock(messageParam.Channel.Id.ToString()))
            {
                // If we didn't manage to acquire the lock, we don't do a thing, another client should already be working on it
                this._telemetryClient.TrackTrace($"Lock failed on channel {messageParam.Channel.Id} ({messageParam.Channel.Name})", SeverityLevel.Information);
                return;
            }
#endif
            // Execute the command with the command context we just
            // created, along with the service provider for precondition checks.

            // Keep in mind that result does not indicate a return value
            // rather an object stating if the command executed successfully.
            var result = await _commands.ExecuteAsync(
                context : context,
                argPos : argPos,
                services : this._serviceProvider);

            // Optionally, we may inform the user if the command fails
            // to be executed; however, this may not always be desired,
            // as it may clog up the request queue should a user spam a
            // command.
            // if (!result.IsSuccess)
            // await context.Channel.SendMessageAsync(result.ErrorReason);
        }
        public async void Updated(SocketGuildUser before, SocketGuildUser after)
        {
            if (before?.Activity?.Name == after?.Activity?.Name ||
                string.IsNullOrWhiteSpace(after?.Activity?.Name))
            {
                //We don't want to overload the bot by trying to do things when the activity name didn't change (ie: status change, match details change in the activity, ...)
                return;
            }

            // Try to lock the user
            if (!await ResourceLock.AcquireLock($"{after.Id}"))
            {
                // If we can't another client is already handling it
                this._telemetry.TrackEvent($"Lock failed on user {after.Id} ({after.Username}#{after.DiscriminatorValue})");
                return;
            }

            this._telemetry.TrackEvent("Handling a user status update");

            var guild = await SearchTable <Guild>(g => g.RowKey == after.Guild.Id.ToString()).GetOneAsync();

            if (guild == null)
            {
                //On aurait pu prendre le guild id du before, pas comme si ça allait changer
                guild = new Guild(after.Guild);

                await guild.InsertAsync();

                //On vient d'ajouter le serveur (guild) à la liste des serveurs connnus, on a plus rien a faire, puisque aucun binding n'existe
                return;
            }

            //On charge les consignes d'assignation
            await guild.LoadChildrens(g => g.RoleAssignations);

            if (!guild.RoleAssignations.Any())
            {
                //Rien a faire, pas d'assignations
                return;
            }

            var orderedAssignations = guild.RoleAssignations.OrderBy(ra => ra.Order).ToList();

            foreach (var orderedAssignation in orderedAssignations)
            {
                try
                {
                    if (orderedAssignation.IsRegExp)
                    {
                        var regexp = new Regex(orderedAssignation.GameName, RegexOptions.IgnoreCase);

                        if (regexp.IsMatch(after.Activity.Name))
                        {
                            var role = after.Guild.GetRole(orderedAssignation.RoleId);

                            await after.AddRoleAsync(role, RequestOptions.Default);

                            return;
                        }
                    }
                    else
                    {
                        if (after.Activity.Name.ToLowerInvariant().Contains(orderedAssignation.GameName.ToLowerInvariant()))
                        {
                            var role = after.Guild.GetRole(orderedAssignation.RoleId);

                            await after.AddRoleAsync(role, RequestOptions.Default);

                            return;
                        }
                    }
                }
                catch (Exception e)
                {
                    this._telemetry.TrackException(e);
                    continue;
                }
            }
        }