Example #1
0
        public DiscordApiData Set(string key, DiscordImageData avatar)
        {
            AssertContainer();

            DiscordApiData apiData = new DiscordApiData(avatar.ToDataUriScheme());

            data[key] = apiData;
            return(apiData);
        }
Example #2
0
        public DiscordImageData GetAvatar(string key)
        {
            AssertContainer();

            string nestedData = GetString(key);

            if (!string.IsNullOrWhiteSpace(nestedData))
            {
                return(DiscordImageData.FromDataUriScheme(nestedData));
            }

            return(null);
        }
Example #3
0
 /// <summary>
 /// Modifies the settings of this webhook.
 /// </summary>
 /// <exception cref="ArgumentException">Thrown if the token is empty or only contains whitespace characters.</exception>
 /// <exception cref="ArgumentNullException">Thrown if token is null.</exception>
 /// <exception cref="DiscordHttpApiException"></exception>
 public Task ModifyWithToken(string token, string name = null, DiscordImageData avatar = null)
 {
     return(http.ModifyWebhookWithToken(Id, token, name, avatar));
 }
Example #4
0
 /// <summary>
 /// Modifies the settings of this webhook.
 /// <para>Requires <see cref="DiscordPermission.ManageWebhooks"/>.</para>
 /// </summary>
 /// <param name="channelId">The ID of the text channel to move this webhook to (or null to not move).</param>
 /// <exception cref="DiscordHttpApiException"></exception>
 public Task <DiscordWebhook> Modify(string name         = null, DiscordImageData avatar = null,
                                     Snowflake?channelId = null)
 {
     return(http.ModifyWebhook(Id, name, avatar, channelId));
 }