Exemplo n.º 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;
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates the webhook's info
        /// </summary>
        public void Update()
        {
            DiscordWebhook hook = Client.GetWebhook(Id, Token);

            Name      = hook.Name;
            _avatarId = hook.Avatar.Hash;
            Creator   = hook.Creator;
            ChannelId = hook.ChannelId;
        }