public async Task <RuntimeResult> DeleteRoleplayAsync
        (
            [RequireEntityOwnerOrPermission(typeof(DeleteRoleplay), PermissionTarget.Other)]
            Roleplay roleplay
        )
        {
            var deletionResult = await _discordRoleplays.DeleteRoleplayAsync(roleplay);

            if (!deletionResult.IsSuccess)
            {
                return(deletionResult.ToRuntimeResult());
            }

            var canReplyInChannelAfterDeletion = (long)this.Context.Channel.Id != roleplay.DedicatedChannelID;

            if (canReplyInChannelAfterDeletion)
            {
                return(RuntimeCommandResult.FromSuccess($"Roleplay \"{roleplay.Name}\" deleted."));
            }

            var eb = _feedback.CreateEmbedBase();

            eb.WithDescription($"Roleplay \"{roleplay.Name}\" deleted.");

            await _feedback.SendPrivateEmbedAsync(this.Context, this.Context.User, eb.Build(), false);

            return(RuntimeCommandResult.FromSuccess());
        }
Пример #2
0
    public async Task <IResult> DeleteRoleplayAsync
    (
        [RequireEntityOwner]
        [AutocompleteProvider("roleplay::owned")]
        Roleplay roleplay
    )
    {
        var deletionResult = await _discordRoleplays.DeleteRoleplayAsync(roleplay);

        if (!deletionResult.IsSuccess)
        {
            return(deletionResult);
        }

        var canReplyInChannelAfterDeletion = _context.ChannelID != roleplay.DedicatedChannelID;

        if (canReplyInChannelAfterDeletion)
        {
            return(Result <FeedbackMessage> .FromSuccess
                   (
                       new FeedbackMessage($"Roleplay \"{roleplay.Name}\" deleted.", _feedback.Theme.Secondary)
                   ));
        }

        var eb = new Embed
        {
            Colour      = _feedback.Theme.Secondary,
            Description = $"Roleplay \"{roleplay.Name}\" deleted."
        };

        return(await _feedback.SendPrivateEmbedAsync(_context.User.ID, eb));
    }
Пример #3
0
        public async Task DeleteRoleplayAsync
        (
            [RequireEntityOwnerOrPermission(typeof(DeleteRoleplay), PermissionTarget.Other)]
            Roleplay roleplay
        )
        {
            var deletionResult = await _discordRoleplays.DeleteRoleplayAsync(roleplay);

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

                return;
            }

            var canReplyInChannelAfterDeletion = (long)this.Context.Channel.Id != roleplay.DedicatedChannelID;

            if (canReplyInChannelAfterDeletion)
            {
                await _feedback.SendConfirmationAsync(this.Context, $"Roleplay \"{roleplay.Name}\" deleted.");
            }
            else
            {
                var eb = _feedback.CreateEmbedBase();
                eb.WithDescription($"Roleplay \"{roleplay.Name}\" deleted.");

                await _feedback.SendPrivateEmbedAsync(this.Context, this.Context.User, eb.Build(), false);
            }
        }