mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-16 03:44:26 +00:00
Added Message URL method
This commit is contained in:
parent
e61d6f5ccf
commit
4d547d6f10
|
@ -52,6 +52,19 @@ type Message struct {
|
||||||
Flags MessageFlags `json:"flags"`
|
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
|
type MessageType uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
Loading…
Reference in a new issue