Documentation ¶
Index ¶
- func API() echotron.API
- func LoadAPI(token string)
- func Log(chatID int64, any ...interface{})
- type Animation
- func (message *Animation) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Animation
- func (message *Animation) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Animation
- func (message *Animation) ForceReply(placeholder string, selective bool) *Animation
- func (message Animation) Send(chatID int64) (res *UpdateMessage, err error)
- type Any
- type Audio
- func (message *Audio) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Audio
- func (message *Audio) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Audio
- func (message *Audio) ForceReply(placeholder string, selective bool) *Audio
- func (message Audio) Send(chatID int64) (res *UpdateMessage, err error)
- type CallbackQuery
- func (callback CallbackQuery) Answer(opts *echotron.CallbackQueryOptions) error
- func (callback CallbackQuery) AnswerAlert(text string, cacheTime uint16) error
- func (callback CallbackQuery) AnswerToast(text string, cacheTime uint16) error
- func (callback CallbackQuery) Delete() error
- func (callback CallbackQuery) EditCaption(opts *echotron.MessageCaptionOptions) error
- func (callback CallbackQuery) EditInlineKeyboard(keyboard [][]echotron.InlineKeyboardButton) error
- func (callback CallbackQuery) EditLiveLocation(latitude, longitude float64, opts *echotron.EditLocationOptions) error
- func (callback CallbackQuery) EditMedia(media echotron.InputMedia, opts *echotron.MessageReplyMarkup) error
- func (callback CallbackQuery) EditText(text string, opts *echotron.MessageTextOptions) error
- type Contact
- func (message *Contact) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Contact
- func (message *Contact) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Contact
- func (message *Contact) ForceReply(placeholder string, selective bool) *Contact
- func (message Contact) Send(chatID int64) (res *UpdateMessage, err error)
- type Dice
- func (message *Dice) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Dice
- func (message *Dice) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Dice
- func (message *Dice) ForceReply(placeholder string, selective bool) *Dice
- func (message Dice) Send(chatID int64) (res *UpdateMessage, err error)
- type Document
- func (message *Document) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Document
- func (message *Document) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Document
- func (message *Document) ForceReply(placeholder string, selective bool) *Document
- func (message Document) Send(chatID int64) (res *UpdateMessage, err error)
- type EntityFilter
- type FileID
- func GrabAnimationFileID(media *echotron.Animation) FileID
- func GrabAudioFileID(media *echotron.Audio) FileID
- func GrabDocumentFileID(media *echotron.Document) FileID
- func GrabPhotoFileID(media *echotron.PhotoSize) FileID
- func GrabStickerFileID(media *echotron.Sticker) FileID
- func GrabVideoFileID(media *echotron.Video) FileID
- func GrabVideoNoteFileID(media *echotron.VideoNote) FileID
- func GrabVoiceFileID(media *echotron.Voice) FileID
- type ForwardInfo
- type Game
- func (message *Game) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Game
- func (message *Game) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Game
- func (message *Game) ForceReply(placeholder string, selective bool) *Game
- func (message Game) Send(chatID int64) (res *UpdateMessage, err error)
- type Location
- func (message *Location) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Location
- func (message *Location) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Location
- func (message *Location) ForceReply(placeholder string, selective bool) *Location
- func (message Location) Send(chatID int64) (res *UpdateMessage, err error)
- type MediaInfo
- type Photo
- func (message *Photo) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Photo
- func (message *Photo) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Photo
- func (message *Photo) ForceReply(placeholder string, selective bool) *Photo
- func (message Photo) Send(chatID int64) (res *UpdateMessage, err error)
- type Poll
- func (message *Poll) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Poll
- func (message *Poll) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Poll
- func (message *Poll) ForceReply(placeholder string, selective bool) *Poll
- func (message Poll) Send(chatID int64) (res *UpdateMessage, err error)
- type Reference
- func (ref Reference) ChatID() int64
- func (ref Reference) Delete() error
- func (ref Reference) EditCaption(opts *echotron.MessageCaptionOptions) error
- func (ref Reference) EditInlineKeyboard(keyboard [][]echotron.InlineKeyboardButton) error
- func (ref Reference) EditLiveLocation(latitude, longitude float64, opts *echotron.EditLocationOptions) error
- func (ref Reference) EditMedia(media echotron.InputMedia, opts *echotron.MessageReplyMarkup) error
- func (ref Reference) EditText(text string, opts *echotron.MessageTextOptions) error
- func (ref Reference) MessageID() int
- type ResponseError
- type Sticker
- func (message *Sticker) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Sticker
- func (message *Sticker) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Sticker
- func (message *Sticker) ForceReply(placeholder string, selective bool) *Sticker
- func (message Sticker) Send(chatID int64) (res *UpdateMessage, err error)
- type SystemNotificationInfo
- type Text
- func (message *Text) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Text
- func (message *Text) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Text
- func (message *Text) ForceReply(placeholder string, selective bool) *Text
- func (message Text) Send(chatID int64) (res *UpdateMessage, err error)
- type Update
- type UpdateMessage
- func (message UpdateMessage) Delete() error
- func (message *UpdateMessage) EditCaption(opts *echotron.MessageCaptionOptions) error
- func (message *UpdateMessage) EditInlineKeyboard(keyboard [][]echotron.InlineKeyboardButton) error
- func (message *UpdateMessage) EditLiveLocation(latitude, longitude float64, opts *echotron.EditLocationOptions) error
- func (message *UpdateMessage) EditMedia(media echotron.InputMedia, opts *echotron.MessageReplyMarkup) error
- func (message *UpdateMessage) EditText(text string, opts *echotron.MessageTextOptions) error
- func (message UpdateMessage) ExtractEntities(filter EntityFilter) (extracted []string)
- func (message UpdateMessage) ExtractEntitiesOfType(allowedTypes ...echotron.MessageEntityType) []string
- type UpdateType
- type Venue
- func (message *Venue) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Venue
- func (message *Venue) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Venue
- func (message *Venue) ForceReply(placeholder string, selective bool) *Venue
- func (message Venue) Send(chatID int64) (res *UpdateMessage, err error)
- type Video
- func (message *Video) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Video
- func (message *Video) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Video
- func (message *Video) ForceReply(placeholder string, selective bool) *Video
- func (message Video) Send(chatID int64) (res *UpdateMessage, err error)
- type VideoNote
- func (message *VideoNote) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *VideoNote
- func (message *VideoNote) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *VideoNote
- func (message *VideoNote) ForceReply(placeholder string, selective bool) *VideoNote
- func (message VideoNote) Send(chatID int64) (res *UpdateMessage, err error)
- type Voice
- func (message *Voice) ClipInlineKeyboard(kbd [][]echotron.InlineKeyboardButton) *Voice
- func (message *Voice) ClipKeyboard(kbd echotron.ReplyKeyboardMarkup) *Voice
- func (message *Voice) ForceReply(placeholder string, selective bool) *Voice
- func (message Voice) Send(chatID int64) (res *UpdateMessage, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func API ¶
func API() echotron.API
API return the current api, useful for compatibility with not yet supported echotron functions calls
func LoadAPI ¶
func LoadAPI(token string)
LoadAPI resets the api to a new value using given token. Keep in mind that both api and token will be already set douring robot.Start and if you don't want to use program's argument, you can use robot.Config.SetAPIToken intead. You are probably NOT going to need this function
Types ¶
type Animation ¶
type Animation struct { File echotron.InputFile Opts *echotron.AnimationOptions }
Animation message type
func (*Animation) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Animation) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Animation) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type Any ¶
type Any interface { // Send the message to the specified user and return a pointer to the messa sent and an error Send(chatID int64) (*UpdateMessage, error) }
Any rapresent any single message type with the exeption of MediaGroup
type Audio ¶
type Audio struct { File echotron.InputFile Opts *echotron.AudioOptions }
Audio message type
func (*Audio) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Audio) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Audio) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type CallbackQuery ¶
type CallbackQuery struct { ID string `json:"id"` From *echotron.User `json:"from"` Message *UpdateMessage `json:"parrbot_message,omitempty"` InlineMessageID string `json:"inline_message_id,omitempty"` ChatInstance string `json:"chat_instance,omitempty"` Data string `json:"data,omitempty"` GameShortName string `json:"game_short_name,omitempty"` }
CallbackQuery is the Parr(b)ot rapresentation the echotron.CallbackQuery, the difference is that it have the custom *UpdateMessage instead of *echotron.Message type for Message field. CallbackQuery implements editable interface
func (CallbackQuery) Answer ¶
func (callback CallbackQuery) Answer(opts *echotron.CallbackQueryOptions) error
Answer allows to reply to a given callback using given options
func (CallbackQuery) AnswerAlert ¶
func (callback CallbackQuery) AnswerAlert(text string, cacheTime uint16) error
AnswerAlert allows to reply to a given callback with a _ notification. The notification may be cached client-side by final user for cacheTime seconds max: 3600s
func (CallbackQuery) AnswerToast ¶
func (callback CallbackQuery) AnswerToast(text string, cacheTime uint16) error
AnswerToast allows to reply to a given callback with a _ notification. The notification may be cached client-side by final user for cacheTime seconds max: 3600s
func (CallbackQuery) Delete ¶
func (callback CallbackQuery) Delete() error
Delete is a method that allows to delete the original message
func (CallbackQuery) EditCaption ¶
func (callback CallbackQuery) EditCaption(opts *echotron.MessageCaptionOptions) error
EditCaption is a method that allows to edit the caption (and others options) ONLY for messages sent by the bot that contain media (like Photo or Document...)
func (CallbackQuery) EditInlineKeyboard ¶
func (callback CallbackQuery) EditInlineKeyboard(keyboard [][]echotron.InlineKeyboardButton) error
EditInlineKeyboard is a method that allows to edit the InlineKeyboard ONLY for messages sent by the bot
func (CallbackQuery) EditLiveLocation ¶
func (callback CallbackQuery) EditLiveLocation(latitude, longitude float64, opts *echotron.EditLocationOptions) error
EditLiveLocation is a method that allows to edit the Location (and others options) ONLY for messages sent by the bot that contain it (like Photo or Document...)
func (CallbackQuery) EditMedia ¶
func (callback CallbackQuery) EditMedia(media echotron.InputMedia, opts *echotron.MessageReplyMarkup) error
EditMedia is a method that allows to edit the media (and others options) ONLY for messages sent by the bot that contain it
func (CallbackQuery) EditText ¶
func (callback CallbackQuery) EditText(text string, opts *echotron.MessageTextOptions) error
EditText is a method that allows to edit the text (and others options) for textual messages (message.Text) sent by the bot
type Contact ¶
type Contact struct {
PhoneNumber, FirstName string
Opts *echotron.ContactOptions
}
Contact message type
func (*Contact) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Contact) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Contact) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type Dice ¶
type Dice struct { Emoji echotron.DiceEmoji Opts *echotron.BaseOptions }
Dice message type
func (*Dice) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Dice) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Dice) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type Document ¶
type Document struct { File echotron.InputFile Opts *echotron.DocumentOptions }
Document message type
func (*Document) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Document) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Document) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type EntityFilter ¶
type EntityFilter func(entity echotron.MessageEntity) bool
EntityFilter is a function checks an entity, returning true if pass false otherwise
func FilterEntityByType ¶
func FilterEntityByType(allowedTypes ...echotron.MessageEntityType) EntityFilter
FilterEntityByType generates an EntityFilter that will return true only if entity's type match at least one of the given ones
type FileID ¶
type FileID string
FileID is the identifier of a sent or recived File of any kind
func GrabAnimationFileID ¶
func GrabAnimationFileID(media *echotron.Animation) FileID
GrabAnimationFileID grabs the FileID from the given media
func GrabAudioFileID ¶
func GrabAudioFileID(media *echotron.Audio) FileID
GrabAudioFileID grabs the FileID from the given media
func GrabDocumentFileID ¶
func GrabDocumentFileID(media *echotron.Document) FileID
GrabDocumentFileID grabs the FileID from the given media
func GrabPhotoFileID ¶
func GrabPhotoFileID(media *echotron.PhotoSize) FileID
GrabPhotoFileID grabs the FileID from the given media
func GrabStickerFileID ¶
func GrabStickerFileID(media *echotron.Sticker) FileID
GrabStickerFileID grabs the FileID from the given media
func GrabVideoFileID ¶
func GrabVideoFileID(media *echotron.Video) FileID
GrabVideoFileID grabs the FileID from the given media
func GrabVideoNoteFileID ¶
func GrabVideoNoteFileID(media *echotron.VideoNote) FileID
GrabVideoNoteFileID grabs the FileID from the given media
func GrabVoiceFileID ¶
func GrabVoiceFileID(media *echotron.Voice) FileID
GrabVoiceFileID grabs the FileID from the given media
func (FileID) RetrieveInfo ¶
RetrieveInfo retrieve the info of a particular file from Telegram servers
type ForwardInfo ¶
type ForwardInfo struct { From *echotron.User `json:"forward_from,omitempty"` Chat *echotron.Chat `json:"forward_from_chat,omitempty"` MessageID int `json:"forward_from_message_id,omitempty"` Signature string `json:"forward_signature,omitempty"` SenderName string `json:"forward_sender_name,omitempty"` Date int `json:"forward_date,omitempty"` Automatic bool `json:"is_automatic_forward_date,omitempty"` }
ForwardInfo countain all the infos of the original message that has been forwarded
type Game ¶
type Game struct { GameShortName string Opts *echotron.BaseOptions }
Game message type
func (*Game) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Game) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Game) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type Location ¶
type Location struct {
Latitude, Longitude float64
Opts *echotron.LocationOptions
}
Location message type
func (*Location) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Location) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Location) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type MediaInfo ¶
type MediaInfo struct { MediaGroupID string `json:"media_group_id,omitempty"` Animation *echotron.Animation `json:"animation,omitempty"` Audio *echotron.Audio `json:"audio,omitempty"` Document *echotron.Document `json:"document,omitempty"` Photo []*echotron.PhotoSize `json:"photo,omitempty"` Sticker *echotron.Sticker `json:"sticker,omitempty"` Video *echotron.Video `json:"video,omitempty"` VideoNote *echotron.VideoNote `json:"video_note,omitempty"` Voice *echotron.Voice `json:"voice,omitempty"` Caption string `json:"caption,omitempty"` CaptionEntities []*echotron.MessageEntity `json:"caption_entities,omitempty"` Contact *echotron.Contact `json:"contact,omitempty"` Dice *echotron.Dice `json:"dice,omitempty"` Game *echotron.Game `json:"game,omitempty"` Poll *echotron.Poll `json:"poll,omitempty"` Venue *echotron.Venue `json:"venue,omitempty"` Location *echotron.Location `json:"location,omitempty"` }
MediaInfo countain all the infos about medias, Polls and so on contained into a message
func (MediaInfo) ExtractFileID ¶
ExtractFileID try to extracts the FileID from the Info of a media
type Photo ¶
type Photo struct { File echotron.InputFile Opts *echotron.PhotoOptions }
Photo message type
func (*Photo) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Photo) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Photo) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type Poll ¶
Poll message type
func (*Poll) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Poll) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Poll) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type Reference ¶
type Reference struct { echotron.MessageIDOptions // contains filtered or unexported fields }
Reference rapresent a reference to an existing message. You can use it to do the same actions (editing or deleting) but with a lighter structure that can used as a echotron.MessageIDOptions thanks to embedding
func NewReference ¶
func NewReference(e editable) *Reference
NewReference creates a new Reference that is referencing the message contained inside an editable (UpdateMessage, CallbackQuery, Update, Reference)
func (Reference) EditCaption ¶
EditCaption allows to edit the caption (and other releated options) ONLY for referenced messages that contain media (like Photo or Document...)
func (Reference) EditInlineKeyboard ¶
EditInlineKeyboard allows to edit the inline keyboard of referenced messages
func (Reference) EditLiveLocation ¶
func (ref Reference) EditLiveLocation(latitude, longitude float64, opts *echotron.EditLocationOptions) error
EditLiveLocation allows to edit the location (and other releated options) ONLY for referenced messages that contain it (like Photo or Document...)
func (Reference) EditMedia ¶
EditMedia allows to edit the media (and other releated options) ONLY for referenced messages that already contain it
type ResponseError ¶
ResponseError is an error generated by a echotron / Telegram resonse
func (ResponseError) Error ¶
func (err ResponseError) Error() string
Error returns a complete error description (by creating this method ResponseError is a error interface)
type Sticker ¶
type Sticker struct { StickerID string Opts *echotron.BaseOptions }
Sticker message type
func (*Sticker) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Sticker) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Sticker) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type SystemNotificationInfo ¶
type SystemNotificationInfo struct { NewChatMembers []*echotron.User `json:"new_chat_members,omitempty"` LeftChatMember *echotron.User `json:"left_chat_member,omitempty"` NewChatTitle string `json:"new_chat_title,omitempty"` NewChatPhoto []*echotron.PhotoSize `json:"new_chat_photo,omitempty"` DeleteChatPhoto bool `json:"delete_chat_photo,omitempty"` GroupChatCreated bool `json:"group_chat_created,omitempty"` SupergroupChatCreated bool `json:"supergroup_chat_created,omitempty"` ChannelChatCreated bool `json:"channel_chat_created,omitempty"` MessageAutoDeleteTimerChanged *echotron.MessageAutoDeleteTimerChanged `json:"message_auto_delete_timer_changed,omitempty"` MigrateToChatID int `json:"migrate_to_chat_id,omitempty"` MigrateFromChatID int `json:"migrate_from_chat_id,omitempty"` ConnectedWebsite string `json:"connected_website,omitempty"` ProximityAlertTriggered *echotron.ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"` VideoChatScheduled *echotron.VideoChatScheduled `json:"video_chat_scheduled,omitempty"` VideoChatStarted *echotron.VideoChatStarted `json:"video_chat_started,omitempty"` VideoChatEnded *echotron.VideoChatEnded `json:"video_chat_ended,omitempty"` VideoChatParticipantsInvited *echotron.VideoChatParticipantsInvited `json:"video_chat_participants_invited,omitempty"` WebAppData *echotron.WebAppData `json:"web_app_data,omitempty"` PinnedMessage *UpdateMessage `json:"parrbot_pinned_message,omitempty"` }
SystemNotificationInfo countain the infos of Telegram's generated message on particular events (part of UpdateMessage)
type Text ¶
type Text struct { Text string Opts *echotron.MessageOptions }
Text message type
func (*Text) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Text) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Text) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type Update ¶
type Update struct { ID int `json:"update_id"` Message *UpdateMessage `json:"parrbot_message,omitempty"` EditedMessage *UpdateMessage `json:"parrbot_edited_message,omitempty"` ChannelPost *UpdateMessage `json:"parrbot_channel_post,omitempty"` EditedChannelPost *UpdateMessage `json:"parrbot_edited_channel_post,omitempty"` InlineQuery *echotron.InlineQuery `json:"inline_query,omitempty"` ChosenInlineResult *echotron.ChosenInlineResult `json:"chosen_inline_result,omitempty"` CallbackQuery *CallbackQuery `json:"parrbot_callback_query,omitempty"` ShippingQuery *echotron.ShippingQuery `json:"shipping_query,omitempty"` PreCheckoutQuery *echotron.PreCheckoutQuery `json:"pre_checkout_query,omitempty"` MyChatMember *echotron.ChatMemberUpdated `json:"my_chat_member,omitempty"` ChatMember *echotron.ChatMemberUpdated `json:"chat_member,omitempty"` ChatJoinRequest *echotron.ChatJoinRequest `json:"chat_join_request,omitempty"` }
Update is the Parr(b)ot rapresentation the echotron.Update, the difference is that it have the custom UpdateMessage (declared on inside the "incoming.go" file of the same packages) instead of echotron.Message type. You can cast a echotron.Update to a Update using the CastUpdate function Update implements editable interface
func CastUpdate ¶
func CastUpdate(original *echotron.Update) (update *Update)
CastUpdate transform an *echotron.Update into a *Update
func (Update) DeleteMessage ¶
Deletes the original message contain in the update if present
func (Update) FromMessage ¶
func (u Update) FromMessage() (msg *UpdateMessage)
FromMessage gets the original message contain in the update if present
type UpdateMessage ¶
type UpdateMessage struct { // Normal Telegram / Echotron fields ID int `json:"message_id"` From *echotron.User `json:"from,omitempty"` // <nil> if channel SenderChat *echotron.Chat `json:"sender_chat,omitempty"` Date int `json:"date"` Chat *echotron.Chat `json:"chat"` EditDate int `json:"edit_date,omitempty"` AuthorSignature string `json:"author_signature,omitempty"` InlineKeyboard *echotron.InlineKeyboardMarkup `json:"reply_markup,omitempty"` // it Changed the name: ReplyMarkup (too generic) -> InlineKeyboard ViaBot *echotron.User `json:"via_bot,omitempty"` ReplyToMessage *UpdateMessage `json:"parrbot_reply_to_message,omitempty"` /* Custom wrappers of information about a specific incoming message type * tips: Thanks to that if you want to check if a message for example * contains a media you can just check if message.Media != nil */ Forward *ForwardInfo `json:"parrbot_forward,omitempty"` Media *MediaInfo `json:"parrbot_media,omitempty"` SystemNotification *SystemNotificationInfo `json:"parrbot_system_notification,omitempty"` /* They countain normal text information or the onse of media caption * when text is empty. Notice however how inside Media (of type *MediaInfo) * there is still a capy of the media caption */ Text string `json:"text,omitempty"` Entities []*echotron.MessageEntity `json:"entities,omitempty"` }
UpdateMessage is the custom type for incoming or just sent message (of any type). It implements editable interface. Tips: Use the json- tags naming to refer to the official Telegram documentation available at: https://core.telegram.org/bots/api#message In the rare cases where the json string start with "parrbot_" then is not a copy-paste of the response
func (UpdateMessage) Delete ¶
func (message UpdateMessage) Delete() error
Delete the given message on the original chat (given message will not sync)
func (*UpdateMessage) EditCaption ¶
func (message *UpdateMessage) EditCaption(opts *echotron.MessageCaptionOptions) error
EditCaption is a method that allows to edit the caption (and others options) ONLY for messages sent by the bot that contain media (like Photo or Document...)
func (*UpdateMessage) EditInlineKeyboard ¶
func (message *UpdateMessage) EditInlineKeyboard(keyboard [][]echotron.InlineKeyboardButton) error
EditInlineKeyboard is a method that allows to edit the InlineKeyboard ONLY for messages sent by the bot
func (*UpdateMessage) EditLiveLocation ¶
func (message *UpdateMessage) EditLiveLocation(latitude, longitude float64, opts *echotron.EditLocationOptions) error
EditLiveLocation is a method that allows to edit the Location (and others options) ONLY for messages sent by the bot that contain it (like Photo or Document...)
func (*UpdateMessage) EditMedia ¶
func (message *UpdateMessage) EditMedia(media echotron.InputMedia, opts *echotron.MessageReplyMarkup) error
EditMedia is a method that allows to edit the media (and others options) ONLY for messages sent by the bot that contain it
func (*UpdateMessage) EditText ¶
func (message *UpdateMessage) EditText(text string, opts *echotron.MessageTextOptions) error
EditText is a method that allows to edit the text (and others options) for textual messages (message.Text) sent by the bot
func (UpdateMessage) ExtractEntities ¶
func (message UpdateMessage) ExtractEntities(filter EntityFilter) (extracted []string)
ExtractEntities extracts the content of the Entities contained inside given message and filtered by given filter function
func (UpdateMessage) ExtractEntitiesOfType ¶
func (message UpdateMessage) ExtractEntitiesOfType(allowedTypes ...echotron.MessageEntityType) []string
ExtractEntitiesOfType extracts the content of the Entities contained filtered by their type
type UpdateType ¶
type UpdateType uint16
UpdateType represent a possible incoming Update types used on the "ReplyAt" Command inside the command list
const ( MESSAGE UpdateType = 1 << iota // 000000000001 EDITED_MESSAGE // 000000000010 CHANNEL_POST // 000000000100 EDITED_CHANNEL_POST // 000000001000 INLINE_QUERY // 000000010000 CHOSEN_INLINE_RESULT // 000000100000 CALLBACK_QUERY // 000001000000 SHIPPING_QUERY // 000010000000 PRE_CHECKOUT_QUERY // 000100000000 MY_CHAT_MEMBER // 001000000000 CHAT_MEMBER // 010000000000 CHAT_JOIN_REQUEST // 100000000000 // ANY represents any possible UpdateType. ANY = (1 << iota) - 1 // 1111111111 )
These are all the possible types of Update. On the side the binary representation Each one can be used as a flag into the "ReplyAt" field of a Command on the command list. Tips: You can even sum them to specify that the command will be executed onreply at for example MESSAGE + CHANNEL_POST (normal written messages and channel posts. If you want all, you can use ANY
type Venue ¶
Venue message type
func (*Venue) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Venue) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Venue) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type Video ¶
type Video struct { File echotron.InputFile Opts *echotron.VideoOptions }
Video message type
func (*Video) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Video) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Video) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type VideoNote ¶
type VideoNote struct { File echotron.InputFile Opts *echotron.VideoNoteOptions }
VideoNote message type
func (*VideoNote) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*VideoNote) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*VideoNote) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent
type Voice ¶
type Voice struct { File echotron.InputFile Opts *echotron.VoiceOptions }
Voice message type
func (*Voice) ClipInlineKeyboard ¶
ClipInlineKeyboard allows to quickly add or change an inline keyboard to the message Opts
func (*Voice) ClipKeyboard ¶
ClipKeyboard allows to quickly add or change the Opts.ReplyMarkup of the current message
func (*Voice) ForceReply ¶
ForceReply allows to quickly force the user to reply to the current message when sent