Esempio n. 1
0
 public async Task <Webhook> CreateWebhookAsync(CreateWebhookParams @params, CancellationToken?token = default(CancellationToken?))
 {
     using (var response = await Post(BuildEndpoint($"projects/{@params.ProjectIdOrKey}/webhooks"), @params, token: token))
         using (var content = response.Content)
         {
             return(await Factory.CreateWebhookAsync(response));
         }
 }
Esempio n. 2
0
        //Webhooks
        public static async Task<RestWebhook> CreateWebhookAsync(ITextChannel channel, BaseDiscordClient client, string name, Stream avatar, RequestOptions options)
        {
            var args = new CreateWebhookParams { Name = name };
            if (avatar != null)
                args.Avatar = new API.Image(avatar);

            var model = await client.ApiClient.CreateWebhookAsync(channel.Id, args, options).ConfigureAwait(false);
            return RestWebhook.Create(client, channel, model);
        }
Esempio n. 3
0
        public async Task <IActionResult> CreateWebhookAsync(Snowflake channelId, [FromBody] CreateWebhookParams args)
        {
            args.Validate();

            return(Ok(new Webhook
            {
                ChannelId = channelId,
                Avatar = args.Avatar.ToNullable(),
                Name = args.Name
            }));
        }