Exemple #1
0
        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)));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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
                }));
            }
        }