From 6cd4b361ce567b9ee4e84e69ccedeaedeb5d43f7 Mon Sep 17 00:00:00 2001 From: "diamondburned (Forefront)" Date: Thu, 5 Mar 2020 15:49:44 -0800 Subject: [PATCH] Discord: Added Channel.IconURL --- discord/channel.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/discord/channel.go b/discord/channel.go index d6cfa33..c8b97e7 100644 --- a/discord/channel.go +++ b/discord/channel.go @@ -45,6 +45,17 @@ func (ch Channel) Mention() string { return "<#" + ch.ID.String() + ">" } +// IconURL returns the icon of the channel. This function will only return +// something if ch.Icon is not empty. +func (ch Channel) IconURL() string { + if ch.Icon == "" { + return "" + } + + return "https://cdn.discordapp.com/channel-icons/" + + ch.ID.String() + "/" + ch.Icon + ".png" +} + type ChannelType uint8 const (