public async Task SetRoleplayNameAsync ( string newRoleplayName, [RequireEntityOwnerOrPermission(typeof(EditRoleplay), PermissionTarget.Other)] Roleplay roleplay ) { var result = await _discordRoleplays.SetRoleplayNameAsync ( roleplay, newRoleplayName ); if (!result.IsSuccess) { await _feedback.SendErrorAsync(this.Context, result.ErrorReason); return; } var getDedicatedChannelResult = await _dedicatedChannels.GetDedicatedChannelAsync ( this.Context.Guild, roleplay ); if (getDedicatedChannelResult.IsSuccess) { var dedicatedChannel = getDedicatedChannelResult.Entity; await dedicatedChannel.ModifyAsync(p => p.Name = $"{roleplay.Name}-rp"); } await _feedback.SendConfirmationAsync(this.Context, "Roleplay name set."); }
public async Task <RuntimeResult> SetRoleplayNameAsync ( string newRoleplayName, [RequireEntityOwnerOrPermission(typeof(EditRoleplay), PermissionTarget.Other)] Roleplay roleplay ) { var result = await _discordRoleplays.SetRoleplayNameAsync ( roleplay, newRoleplayName ); if (!result.IsSuccess) { return(result.ToRuntimeResult()); } var getDedicatedChannelResult = await _dedicatedChannels.GetDedicatedChannelAsync ( this.Context.Guild, roleplay ); if (!getDedicatedChannelResult.IsSuccess) { return(RuntimeCommandResult.FromSuccess("Roleplay name set.")); } var dedicatedChannel = getDedicatedChannelResult.Entity; await dedicatedChannel.ModifyAsync(p => p.Name = $"{roleplay.Name}-rp"); return(RuntimeCommandResult.FromSuccess("Roleplay name set.")); }
public async Task <Result <FeedbackMessage> > SetRoleplayNameAsync ( string newRoleplayName, [RequireEntityOwner] [AutocompleteProvider("roleplay::owned")] Roleplay roleplay ) { var result = await _discordRoleplays.SetRoleplayNameAsync ( roleplay, newRoleplayName ); return(!result.IsSuccess ? Result <FeedbackMessage> .FromError(result) : new FeedbackMessage("Roleplay name set.", _feedback.Theme.Secondary)); }