This commit is contained in:
Rogee
2024-09-02 20:09:57 +08:00
parent 422a5a9cab
commit d3806983a4
2 changed files with 53 additions and 8 deletions

View File

@@ -15,9 +15,10 @@ type ChannelMessage struct {
}
type ChannelMessageMedia struct {
Photo string
Video string
WebPage ChannelMessageMediaWebPage
Photo string
Video string
Document string
WebPage ChannelMessageMediaWebPage
}
type ChannelMessageMediaWebPage struct {
@@ -49,6 +50,11 @@ func (c *ChannelMessage) WithVideo(video string) *ChannelMessage {
return c
}
func (c *ChannelMessage) WithDoc(docID int64, ext string) *ChannelMessage {
c.Medias = append(c.Medias, ChannelMessageMedia{Document: fmt.Sprintf("%d.%s", docID, ext)})
return c
}
func (c *ChannelMessage) WithWebPage(title, url string) *ChannelMessage {
c.Medias = append(c.Medias, ChannelMessageMedia{WebPage: ChannelMessageMediaWebPage{Title: title, URL: url}})
return c