1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-09-27 20:58:50 +00:00

Added Message URL method

This commit is contained in:
diamondburned (Forefront) 2020-01-23 21:49:34 -08:00
parent e61d6f5ccf
commit 4d547d6f10

View file

@ -52,6 +52,19 @@ type Message struct {
Flags MessageFlags `json:"flags"`
}
// URL generates a Discord client URL to the message. If the message doesn't
// have a GuildID, it will generate a URL with the guild "@me".
func (m Message) URL() string {
var head = "https://discordapp.com/channels/"
var tail = "/" + m.ChannelID.String() + "/" + m.ID.String()
if !m.GuildID.Valid() {
return head + "@me" + tail
}
return head + m.GuildID.String() + tail
}
type MessageType uint8
const (