Something went wrong. Try again.
A command-line bot client for Chatto. beardicus.tngl.io/chatline
Something went wrong. Try again.
12345678910111213141516171819202122232425262728package api
import ( "net/url" "strings")
// Permalink is the web link to a message, in the form Chatto's "Copy link"// gives: /chat/-/<room>[/<thread root>]/m/<message> on the server's origin,// where "-" means the server the link is on. DMs use the room ID too. The// web app's /user/<id> form names the viewer's partner, so it means a// different room to each side of the DM.func (c *Client) Permalink(roomID, threadID, messageID string) string { segs := []string{roomID} if threadID != "" && threadID != messageID { segs = append(segs, threadID) } segs = append(segs, "m", messageID) for i, s := range segs { segs[i] = url.PathEscape(s) } origin := c.ServerURL if u, err := url.Parse(c.ServerURL); err == nil && u.Host != "" { origin = u.Scheme + "://" + u.Host } return origin + "/chat/-/" + strings.Join(segs, "/")}