public static async Task <RestDMChannel> CreateDMChannelAsync(IUser user, BaseDiscordClient client, RequestOptions options) { CreateDMChannelParams args = new CreateDMChannelParams(user.Id); return(RestDMChannel.Create(client, await client.ApiClient.CreateDMChannelAsync(args, options).ConfigureAwait(false))); }
public async Task <IDMChannel> CreateDMChannelAsync() { var args = new CreateDMChannelParams { Recipient = this }; var model = await Discord.ApiClient.CreateDMChannelAsync(args).ConfigureAwait(false); return(new DMChannel(Discord, new User(model.Recipients.Value[0]), model)); }
public async Task <IActionResult> CreateDMChannelAsync([FromBody] CreateDMChannelParams args) { args.Validate(); if (args.RecipientId.IsSpecified) { return(Ok(new Channel { Type = ChannelType.Dm, Recipients = new User[] { new User { Id = args.RecipientId.Value } } })); } else { return(Ok(new Channel { Type = ChannelType.GroupDm })); } }