package discord import ( "bytes" "github.com/bwmarrin/discordgo" "image" ) func getGuildIcon(s *discordgo.Session, guild *discordgo.UserGuild) (image.Image, error) { body, err := s.RequestWithBucketID("GET", discordgo.EndpointGuildIcon(guild.ID, guild.Icon), nil, discordgo.EndpointGuildIcon(guild.ID, "")) if err != nil { return nil, nil } img, _, err := image.Decode(bytes.NewReader(body)) return img, err }