Story Bound Methods
When a *types.Story is returned by the client (e.g. from client.GetPeerStories()), it has bound convenience methods for interacting with that story.
stories, _ := client.GetPeerStories(ctx, peerID)
story := stories[0]
story.React("🔥")
story.Forward(chatID)All methods return ErrNoBinder if the Story was not created by a client.
Reply
Send a text reply to this story.
func (s *Story) Reply(text string, opts ...*params.SendMessage) (*Message, error)ReplyText is an alias for Reply.
Example:
msg, err := story.Reply("Nice story!", ¶ms.SendMessage{
ReplyTo: ¶ms.ReplyTo{StoryID: story.ID},
})ReplyMedia
Reply to this story with media.
func (s *Story) ReplyMedia(media tg.InputMediaClass, caption string, opts ...*params.SendMessage) (*Message, error)ReplyPhoto
Reply with a cached photo by file ID.
func (s *Story) ReplyPhoto(fileID, accessHash int64, caption string, opts ...*params.SendMessage) (*Message, error)ReplyAnimation
Reply with a cached animation/GIF by file ID.
func (s *Story) ReplyAnimation(fileID, accessHash int64, caption string, opts ...*params.SendMessage) (*Message, error)ReplyAudio / ReplyVideo / ReplyVoice / ReplyVideoNote / ReplySticker
Reply with the corresponding cached media type by file ID and access hash.
func (s *Story) ReplyAudio(fileID, accessHash int64, caption string, opts ...*params.SendMessage) (*Message, error)
func (s *Story) ReplyVideo(fileID, accessHash int64, caption string, opts ...*params.SendMessage) (*Message, error)
func (s *Story) ReplyVideoNote(fileID, accessHash int64, opts ...*params.SendMessage) (*Message, error)
func (s *Story) ReplyVoice(fileID, accessHash int64, caption string, opts ...*params.SendMessage) (*Message, error)
func (s *Story) ReplySticker(fileID, accessHash int64, opts ...*params.SendMessage) (*Message, error)ReplyCachedMedia
Reply with any cached media by file ID and access hash.
func (s *Story) ReplyCachedMedia(fileID, accessHash int64, caption string, opts ...*params.SendMessage) (*Message, error)ReplyMediaGroup
Reply with a group of media (album). Stub — not yet implemented.
func (s *Story) ReplyMediaGroup(media []tg.InputMediaClass, opts ...*params.SendMessage) ([]*Message, error)Forward
Forward this story to another chat.
func (s *Story) Forward(chatID int64, opts ...*params.StoryForward) (*Message, error)Parameters:
| Parameter | Type | Description |
|---|---|---|
| chatID | int64 | Target chat ID |
| opts | ...*params.StoryForward | Optional forward parameters |
Example:
msg, err := story.Forward(targetChatID)Copy
Copy this story to another chat (alias for Forward).
func (s *Story) Copy(chatID int64, opts ...*params.StoryForward) (*Message, error)Delete
Delete this story.
func (s *Story) Delete() errorExample:
err := story.Delete()EditCaption
Edit the caption of this story.
func (s *Story) EditCaption(caption string) (*Story, error)Parameters:
| Parameter | Type | Description |
|---|---|---|
| caption | string | New caption text |
EditMedia
Edit the media of this story.
func (s *Story) EditMedia(media tg.InputMediaClass) (*Story, error)EditPrivacy
Edit the privacy settings of this story.
func (s *Story) EditPrivacy(opts ...*params.EditPrivacy) (*Story, error)React
React to this story with an emoji.
func (s *Story) React(emoji string) errorExample:
err := story.React("❤️")Download
Download the story media.
func (s *Story) Download(opts ...*params.Download) ([]byte, error)Example:
data, err := story.Download()
os.WriteFile("story.jpg", data, 0644)Read
Mark this story as read. View is an alias.
func (s *Story) Read() error
func (s *Story) View() error