Page MenuHomeAITSYS Dev

[Upcoming] Role Icons
Closed, ResolvedPublic

Description

property for role icon "icon" as data string image/png base64

/// <summary>
/// Gets the guild icon's hash.
/// </summary>
[JsonProperty("icon", NullValueHandling = NullValueHandling.Ignore)]
public string IconHash { get; internal set; }

/// <summary>
/// Gets the guild icon's url.
/// </summary>
[JsonIgnore]
public string IconUrl
    => !string.IsNullOrWhiteSpace(this.IconHash) ? $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Url}{Endpoints.ICONS}/{this.Id.ToString(CultureInfo.InvariantCulture)}/{this.IconHash}.{(this.IconHash.StartsWith("a_") ? "gif" : "png")}?size=1024" : null;
/// <summary>
/// The new guild icon.
/// </summary>
public Optional<Stream> Icon { internal get; set; }
    var iconb64 = Optional.FromNoValue<string>();
    if (mdl.Icon.HasValue && mdl.Icon.Value != null)
        using (var imgtool = new ImageTool(mdl.Icon.Value))
            iconb64 = imgtool.GetBase64();
    else if (mdl.Icon.HasValue)
        iconb64 = null;

Optional<string> iconb64

/// <summary>
/// Gets or sets the icon base64.
/// </summary>
[JsonProperty("icon")]
public Optional<string> IconBase64 { get; set; }

icon als memory stream

Revisions and Commits

Event Timeline

aiko created this object with edit policy "DisCatSharp (Project)".
/// <summary>
/// Gets the guild icon's hash.
/// </summary>
[JsonProperty("icon", NullValueHandling = NullValueHandling.Ignore)]
public string IconHash { get; internal set; }

/// <summary>
/// Gets the guild icon's url.
/// </summary>
[JsonIgnore]
public string IconUrl
    => !string.IsNullOrWhiteSpace(this.IconHash) ? $"{DiscordDomain.GetDomain(CoreDomain.DiscordCdn).Url}{Endpoints.ICONS}/{this.Id.ToString(CultureInfo.InvariantCulture)}/{this.IconHash}.{(this.IconHash.StartsWith("a_") ? "gif" : "png")}?size=1024" : null;
/// <summary>
/// The new guild icon.
/// </summary>
public Optional<Stream> Icon { internal get; set; }
    var iconb64 = Optional.FromNoValue<string>();
    if (mdl.Icon.HasValue && mdl.Icon.Value != null)
        using (var imgtool = new ImageTool(mdl.Icon.Value))
            iconb64 = imgtool.GetBase64();
    else if (mdl.Icon.HasValue)
        iconb64 = null;

Optional<string> iconb64

/// <summary>
/// Gets or sets the icon base64.
/// </summary>
[JsonProperty("icon")]
public Optional<string> IconBase64 { get; set; }

icon als memory stream

aiko changed the task status from Open to Testing.Aug 26 2021, 23:43
aiko moved this task from Features to Testing on the DisCatSharp board.
aiko moved this task from Testing to Fixed/Done on the DisCatSharp board.