Пример #1
0
        /// <summary>
        /// Modifies the webhook
        /// </summary>
        /// <param name="properties">Options for modifying the webhook</param>
        public void Modify(DiscordWebhookProperties properties)
        {
            DiscordWebhook hook = Client.ModifyWebhook(Id, properties);

            Name      = hook.Name;
            _avatarId = hook.Avatar.Hash;
            ChannelId = hook.ChannelId;
        }
Пример #2
0
 /// <summary>
 /// Modifies a webhook
 /// </summary>
 /// <param name="webhookId">ID of the webhook</param>
 /// <param name="properties">Options for modifyiing a webhook</param>
 /// <returns>The modified webhook</returns>
 public static DiscordWebhook ModifyWebhook(this DiscordClient client, ulong webhookId, DiscordWebhookProperties properties)
 {
     return(client.HttpClient.Patch($"/webhooks/{webhookId}", properties).Deserialize <DiscordWebhook>().SetClient(client));
 }
Пример #3
0
        /// <summary>
        /// Creates a webhook
        /// </summary>
        /// <param name="channelId">ID of the channel</param>
        /// <param name="properties">Options for creating/modifying the webhook</param>
        /// <returns>The created webhook</returns>
        public static DiscordWebhook CreateChannelWebhook(this DiscordClient client, ulong channelId, DiscordWebhookProperties properties)
        {
            properties.ChannelId = channelId;
            DiscordWebhook hook = client.HttpClient.Post($"/channels/{channelId}/webhooks", properties).Deserialize <DiscordWebhook>().SetClient(client);

            hook.Modify(properties);
            return(hook);
        }