public async Task <RuntimeResult> CreateRoleplayAsync
        (
            string roleplayName,
            string roleplaySummary = "No summary set.",
            bool isNSFW            = false,
            bool isPublic          = true
        )
        {
            if (!(this.Context.User is IGuildUser guildUser))
            {
                return(RuntimeCommandResult.FromError("The current user isn't a guild user."));
            }

            var result = await _discordRoleplays.CreateRoleplayAsync
                         (
                guildUser,
                roleplayName,
                roleplaySummary,
                isNSFW,
                isPublic
                         );

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

            return(RuntimeCommandResult.FromSuccess($"Roleplay \"{result.Entity.Name}\" created."));
        }
Esempio n. 2
0
        public async Task CreateRoleplayAsync
        (
            string roleplayName,
            string roleplaySummary = "No summary set.",
            bool isNSFW            = false,
            bool isPublic          = true
        )
        {
            if (!(this.Context.User is IGuildUser guildUser))
            {
                return;
            }

            var result = await _discordRoleplays.CreateRoleplayAsync
                         (
                guildUser,
                roleplayName,
                roleplaySummary,
                isNSFW,
                isPublic
                         );

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

                return;
            }

            await _feedback.SendConfirmationAsync(this.Context, $"Roleplay \"{result.Entity.Name}\" created.");
        }
    public async Task <Result <FeedbackMessage> > CreateRoleplayAsync
    (
        string roleplayName,
        string roleplaySummary = "No summary set.",
        bool isNSFW            = false,
        bool isPublic          = true
    )
    {
        var result = await _discordRoleplays.CreateRoleplayAsync
                     (
            _context.GuildID.Value,
            _context.User.ID,
            roleplayName,
            roleplaySummary,
            isNSFW,
            isPublic
                     );

        return(!result.IsSuccess
            ? Result <FeedbackMessage> .FromError(result)
            : new FeedbackMessage($"Roleplay \"{result.Entity.Name}\" created.", _feedback.Theme.Secondary));
    }