mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-15 19:33:17 +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"`
|
||||
}
|
||||
|
||||
// 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 (
|
||||
|
|
Loading…
Reference in a new issue