private async void CustomCommand_OnRemoveCommand(object sender, OnChatCommandReceivedArgs e)
        {
            if (!await Permission.Can(e.Command, false, 2).ConfigureAwait(false))
            {
                return;
            }

            Match commandMatch = this._commandRemoveRegex.Match(e.Command.ArgumentsAsString);

            if (commandMatch.Success)
            {
                string command = commandMatch.Groups["command"].Value.ToLowerInvariant();

                if (await PluginManager.DoesCustomChatCommandExistAsync(e.Command.ChatMessage.RoomId, command).ConfigureAwait(false))
                {
                    IMongoCollection <CommandDocument> collection = DatabaseClient.Instance.MongoDatabase.GetCollection <CommandDocument>(CommandDocument.CollectionName);

                    FilterDefinition <CommandDocument> filter = Builders <CommandDocument> .Filter.Where(c => c.ChannelId == e.Command.ChatMessage.RoomId && !c.IsWhisperCommand && c.Command == command);

                    _ = await collection.DeleteOneAsync(filter).ConfigureAwait(false);

                    //TODO: Unregister custom permission

                    // Command removed.
                    TwitchLibClient.Instance.SendMessage(e.Command.ChatMessage.Channel,
                                                         await I18n.Instance.GetAndFormatWithAsync("CustomCommand", "RemoveSuccess", e.Command.ChatMessage.RoomId,
                                                                                                   new
                    {
                        CommandPrefix = PluginManager.Instance.ChatCommandIdentifier,
                        Command       = command,
                        User          = e.Command.ChatMessage.Username,
                        Sender        = e.Command.ChatMessage.Username,
                        e.Command.ChatMessage.DisplayName
                    },
                                                                                                   "@{DisplayName}, the command {CommandPrefix}{Command} has been removed.").ConfigureAwait(false));
                }
                else
                {
                    // Command doesn't exist.
                    TwitchLibClient.Instance.SendMessage(e.Command.ChatMessage.Channel,
                                                         await I18n.Instance.GetAndFormatWithAsync("CustomCommand", "RemoveNotExists", e.Command.ChatMessage.RoomId,
                                                                                                   new
                    {
                        CommandPrefix = PluginManager.Instance.ChatCommandIdentifier,
                        Command       = command,
                        User          = e.Command.ChatMessage.Username,
                        Sender        = e.Command.ChatMessage.Username,
                        e.Command.ChatMessage.DisplayName
                    },
                                                                                                   "@{DisplayName}, the command {CommandPrefix}{Command} cannot be removed as it doesn't exist.").ConfigureAwait(false));
                }
            }
            else
            {
                // Wrong syntax.
                TwitchLibClient.Instance.SendMessage(e.Command.ChatMessage.Channel,
                                                     await I18n.Instance.GetAndFormatWithAsync("CustomCommand", "RemoveUsage", e.Command.ChatMessage.RoomId,
                                                                                               new
                {
                    CommandPrefix = PluginManager.Instance.ChatCommandIdentifier,
                    User          = e.Command.ChatMessage.Username,
                    Sender        = e.Command.ChatMessage.Username,
                    e.Command.ChatMessage.DisplayName
                },
                                                                                               "@{DisplayName}, Removes a custom command. Usage: {CommandPrefix}command remove {CommandPrefix}[command]").ConfigureAwait(false));
            }
        }
        private async void CustomCommand_OnEditCommand(object sender, OnChatCommandReceivedArgs e)
        {
            if (!await Permission.Can(e.Command, false, 2).ConfigureAwait(false))
            {
                return;
            }

            Match commandMatch = this._commandAddEditRegex.Match(e.Command.ArgumentsAsString);

            if (commandMatch.Success)
            {
                string command = commandMatch.Groups["command"].Value.ToLowerInvariant();

                if (await PluginManager.DoesCustomChatCommandExistAsync(e.Command.ChatMessage.RoomId, command).ConfigureAwait(false))
                {
                    UserLevels userLevel = GetUserLevelFromTag(commandMatch.Groups["userlevel"].Value);
                    string     response  = commandMatch.Groups["response"].Value;

                    IMongoCollection <CommandDocument> collection = DatabaseClient.Instance.MongoDatabase.GetCollection <CommandDocument>(CommandDocument.CollectionName);

                    // Update the document.
                    UpdateDefinition <CommandDocument> update = Builders <CommandDocument> .Update.Set(c => c.Response, response);

                    FilterDefinition <CommandDocument> filter = Builders <CommandDocument> .Filter.Where(c => c.ChannelId == e.Command.ChatMessage.RoomId && !c.IsWhisperCommand && c.Command == command);

                    // Update permission if the user specified it.
                    if (!string.IsNullOrEmpty(commandMatch.Groups["userlevel"].Value))
                    {
                        _ = update.Set(c => c.UserLevel, userLevel);
                    }

                    _ = await collection.UpdateOneAsync(filter, update).ConfigureAwait(false);

                    // Command modified.
                    TwitchLibClient.Instance.SendMessage(e.Command.ChatMessage.Channel,
                                                         await I18n.Instance.GetAndFormatWithAsync("CustomCommand", "ModifySuccess", e.Command.ChatMessage.RoomId,
                                                                                                   new
                    {
                        CommandPrefix = PluginManager.Instance.ChatCommandIdentifier,
                        Command       = command,
                        Response      = response,
                        User          = e.Command.ChatMessage.Username,
                        Sender        = e.Command.ChatMessage.Username,
                        e.Command.ChatMessage.DisplayName
                    },
                                                                                                   "@{DisplayName}, the command {CommandPrefix}{Command} has been modified with the response: {Response}").ConfigureAwait(false));
                }
                else
                {
                    // Command does not exist.
                    TwitchLibClient.Instance.SendMessage(e.Command.ChatMessage.Channel,
                                                         await I18n.Instance.GetAndFormatWithAsync("CustomCommand", "ModifyNotExists", e.Command.ChatMessage.RoomId,
                                                                                                   new
                    {
                        CommandPrefix = PluginManager.Instance.ChatCommandIdentifier,
                        Command       = command,
                        User          = e.Command.ChatMessage.Username,
                        Sender        = e.Command.ChatMessage.Username,
                        e.Command.ChatMessage.DisplayName
                    },
                                                                                                   "@{DisplayName}, the command {CommandPrefix}{Command} cannot be modified as it doesn't exist.").ConfigureAwait(false));
                }
            }
            else
            {
                // Wrong syntax.
                TwitchLibClient.Instance.SendMessage(e.Command.ChatMessage.Channel,
                                                     await I18n.Instance.GetAndFormatWithAsync("CustomCommand", "ModifyUsage", e.Command.ChatMessage.RoomId,
                                                                                               new
                {
                    CommandPrefix = PluginManager.Instance.ChatCommandIdentifier,
                    User          = e.Command.ChatMessage.Username,
                    Sender        = e.Command.ChatMessage.Username,
                    e.Command.ChatMessage.DisplayName
                },
                                                                                               "@{DisplayName}, Modifies a command. Usage: {CommandPrefix}command modify {CommandPrefix}[command] [permission (optional)] [response]").ConfigureAwait(false));
            }
        }