/// <summary> /// Creates a new roleplay with the given owner and parameters. /// </summary> /// <param name="guildID">The ID of the guild the user is on.</param> /// <param name="userID">The ID of the user.</param> /// <param name="name">The name of the roleplay.</param> /// <param name="summary">A short summary.</param> /// <param name="isNSFW">Whether the roleplay is NSFW.</param> /// <param name="isPublic">Whether the roleplay is public.</param> /// <returns>A creation result which may or may not have succeeded.</returns> public async Task <Result <Roleplay> > CreateRoleplayAsync ( Snowflake guildID, Snowflake userID, string name, string summary, bool isNSFW, bool isPublic ) { var getUser = await _users.GetOrRegisterUserAsync(userID); if (!getUser.IsSuccess) { return(Result <Roleplay> .FromError(getUser)); } var user = getUser.Entity; var getServer = await _servers.GetOrRegisterServerAsync(guildID); if (!getServer.IsSuccess) { return(Result <Roleplay> .FromError(getServer)); } var server = getServer.Entity; var createRoleplay = await _roleplays.CreateRoleplayAsync(user, server, name, summary, isNSFW, isPublic); if (!createRoleplay.IsSuccess) { return(createRoleplay); } var roleplay = createRoleplay.Entity; var createChannel = await _dedicatedChannels.CreateDedicatedChannelAsync(roleplay); return(!createChannel.IsSuccess ? Result <Roleplay> .FromError(createChannel) : roleplay); }
public async Task CreateRoleplayAsync ( [NotNull] string roleplayName, [NotNull] string roleplaySummary = "No summary set.", bool isNSFW = false, bool isPublic = true ) { var result = await _roleplays.CreateRoleplayAsync(this.Context, 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."); }