This commit is contained in:
Rogee
2024-09-02 19:51:29 +08:00
parent 399dbe4264
commit 422a5a9cab
3 changed files with 19 additions and 3 deletions

View File

@@ -15,8 +15,14 @@ type ChannelMessage struct {
}
type ChannelMessageMedia struct {
Photo string
Video string
Photo string
Video string
WebPage ChannelMessageMediaWebPage
}
type ChannelMessageMediaWebPage struct {
Title string
URL string
}
func NewChannelMessage(id, ts int) *ChannelMessage {
@@ -43,6 +49,11 @@ func (c *ChannelMessage) WithVideo(video string) *ChannelMessage {
return c
}
func (c *ChannelMessage) WithWebPage(title, url string) *ChannelMessage {
c.Medias = append(c.Medias, ChannelMessageMedia{WebPage: ChannelMessageMediaWebPage{Title: title, URL: url}})
return c
}
func (c *ChannelMessage) GetMedia() string {
b, _ := json.Marshal(c.Medias)
return string(b)