Пример #1
0
        public async Task DeleteWarningAsync(long warningID)
        {
            var getWarning = await _warnings.GetWarningAsync(this.Context.Guild, warningID);

            if (!getWarning.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, getWarning.ErrorReason);

                return;
            }

            var warning = getWarning.Entity;

            var deleteWarning = await _warnings.DeleteWarningAsync(warning);

            if (!deleteWarning.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, deleteWarning.ErrorReason);

                return;
            }

            await _feedback.SendConfirmationAsync(this.Context, "Warning deleted.");

            var rescinder = await this.Context.Guild.GetUserAsync(this.Context.User.Id);

            await _logging.NotifyUserWarningRemoved(warning, rescinder);
        }
Пример #2
0
        public async Task DeleteWarningAsync(long warningID)
        {
            var getWarning = await _warnings.GetWarningAsync(this.Context.Guild, warningID);

            if (!getWarning.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, getWarning.ErrorReason);

                return;
            }

            var warning = getWarning.Entity;

            // This has to be done before the warning is actually deleted - otherwise, the lazy loader is removed and
            // navigation properties can't be evaluated
            var rescinder = await this.Context.Guild.GetUserAsync(this.Context.User.Id);

            await _logging.NotifyUserWarningRemoved(warning, rescinder);

            var deleteWarning = await _warnings.DeleteWarningAsync(warning);

            if (!deleteWarning.IsSuccess)
            {
                await _feedback.SendErrorAsync(this.Context, deleteWarning.ErrorReason);

                return;
            }

            await _feedback.SendConfirmationAsync(this.Context, "Warning deleted.");
        }