public async Task <RuntimeResult> StartRoleplayAsync ( [RequireEntityOwnerOrPermission(typeof(StartStopRoleplay), PermissionTarget.Other)] Roleplay roleplay ) { var startRoleplayResult = await _discordRoleplays.StartRoleplayAsync ( (ITextChannel)this.Context.Channel, roleplay ); if (!startRoleplayResult.IsSuccess) { return(startRoleplayResult.ToRuntimeResult()); } var joinedUsers = roleplay.JoinedUsers.Select ( async p => await this.Context.Client.GetUserAsync((ulong)p.User.DiscordID) ); var joinedMentions = joinedUsers.Select(async u => (await u).Mention); var channel = await this.Context.Guild.GetTextChannelAsync((ulong)roleplay.ActiveChannelID !); var participantList = (await Task.WhenAll(joinedMentions)).Humanize(); await channel.SendMessageAsync($"Calling {participantList}!"); var activationMessage = $"The roleplay \"{roleplay.Name}\" is now active in " + $"{MentionUtils.MentionChannel(channel.Id)}."; return(RuntimeCommandResult.FromSuccess(activationMessage)); }
public async Task <Result <FeedbackMessage> > StartRoleplayAsync ( [RequireEntityOwner] [AutocompleteProvider("roleplay::owned")] Roleplay roleplay ) { var startRoleplayResult = await _discordRoleplays.StartRoleplayAsync ( _context.ChannelID, roleplay ); if (!startRoleplayResult.IsSuccess) { return(Result <FeedbackMessage> .FromError(startRoleplayResult)); } var activationMessage = $"The roleplay \"{roleplay.Name}\" is now active in " + $"<#{roleplay.ActiveChannelID!.Value}>."; return(new FeedbackMessage(activationMessage, _feedback.Theme.Secondary)); }