✨ Added NewRedirectURL helper
This commit is contained in:
parent
7d077bbe10
commit
9064ecbab3
|
@ -138,3 +138,34 @@ func (bot *Bot) NewFileURL(filePath string) *url.URL {
|
||||||
Path: fmt.Sprint("/file/bot", bot.AccessToken, "/", filePath),
|
Path: fmt.Sprint("/file/bot", bot.AccessToken, "/", filePath),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bot *Bot) NewRedirectURL(param string, group bool) *url.URL {
|
||||||
|
if bot == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if bot.Self == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if bot.Self.Username == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
link := &url.URL{
|
||||||
|
Scheme: "https",
|
||||||
|
Host: "t.me",
|
||||||
|
Path: bot.Self.Username,
|
||||||
|
}
|
||||||
|
|
||||||
|
q := link.Query()
|
||||||
|
if group {
|
||||||
|
q.Add("startgroup", param)
|
||||||
|
} else {
|
||||||
|
q.Add("start", param)
|
||||||
|
}
|
||||||
|
|
||||||
|
link.RawQuery = q.Encode()
|
||||||
|
|
||||||
|
return link
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user