Documentation
¶
Overview ¶
Package inline contains inline query results builder.
Index ¶
- Constants
- type ArticleResultBuilder
- func (b *ArticleResultBuilder) Content(content tg.InputWebDocument) *ArticleResultBuilder
- func (b *ArticleResultBuilder) Description(description string) *ArticleResultBuilder
- func (b *ArticleResultBuilder) ID(id string) *ArticleResultBuilder
- func (b *ArticleResultBuilder) Thumb(thumb tg.InputWebDocument) *ArticleResultBuilder
- func (b *ArticleResultBuilder) Title(title string) *ArticleResultBuilder
- func (b *ArticleResultBuilder) URL(url string) *ArticleResultBuilder
- type DocumentResultBuilder
- func Audio(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
- func Document(doc tg.InputDocumentClass, typ string, msg MessageOption) *DocumentResultBuilder
- func File(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
- func GIF(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
- func MPEG4GIF(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
- func Sticker(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
- func Video(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
- func Voice(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
- type GameResultBuilder
- type MessageGameBuilder
- type MessageMediaAutoBuilder
- type MessageMediaGeoBuilder
- func (b *MessageMediaGeoBuilder) Heading(heading int) *MessageMediaGeoBuilder
- func (b *MessageMediaGeoBuilder) Markup(m tg.ReplyMarkupClass) *MessageMediaGeoBuilder
- func (b *MessageMediaGeoBuilder) Period(dur time.Duration) *MessageMediaGeoBuilder
- func (b *MessageMediaGeoBuilder) PeriodSeconds(period int) *MessageMediaGeoBuilder
- func (b *MessageMediaGeoBuilder) ProximityNotificationRadius(radius int) *MessageMediaGeoBuilder
- func (b *MessageMediaGeoBuilder) Row(buttons ...tg.KeyboardInlineButton) *MessageMediaGeoBuilder
- type MessageOption
- type MessageSharedWidgetBuilder
- func (b *MessageSharedWidgetBuilder) ChatData(data string) *MessageSharedWidgetBuilder
- func (b *MessageSharedWidgetBuilder) InvertMedia(invert bool) *MessageSharedWidgetBuilder
- func (b *MessageSharedWidgetBuilder) Markup(m tg.ReplyMarkupClass) *MessageSharedWidgetBuilder
- func (b *MessageSharedWidgetBuilder) Row(buttons ...tg.KeyboardInlineButton) *MessageSharedWidgetBuilder
- type MessageTextBuilder
- type MessageWidgetBuilder
- func (b *MessageWidgetBuilder) AllowQueries(allow bool) *MessageWidgetBuilder
- func (b *MessageWidgetBuilder) ChatData(data string) *MessageWidgetBuilder
- func (b *MessageWidgetBuilder) InvertMedia(invert bool) *MessageWidgetBuilder
- func (b *MessageWidgetBuilder) Markup(m tg.ReplyMarkupClass) *MessageWidgetBuilder
- func (b *MessageWidgetBuilder) PublicData(data string) *MessageWidgetBuilder
- func (b *MessageWidgetBuilder) Row(buttons ...tg.KeyboardInlineButton) *MessageWidgetBuilder
- func (b *MessageWidgetBuilder) Shared(shared bool) *MessageWidgetBuilder
- func (b *MessageWidgetBuilder) Size(width, height int) *MessageWidgetBuilder
- type PhotoResultBuilder
- type ResultBuilder
- func (r *ResultBuilder) CacheTime(cacheTime time.Duration) *ResultBuilder
- func (r *ResultBuilder) CacheTimeSeconds(cacheTime int) *ResultBuilder
- func (r *ResultBuilder) Gallery(gallery bool) *ResultBuilder
- func (r *ResultBuilder) NextOffset(nextOffset string) *ResultBuilder
- func (r *ResultBuilder) Private(private bool) *ResultBuilder
- func (r *ResultBuilder) Set(ctx context.Context, opts ...ResultOption) (bool, error)
- func (r *ResultBuilder) SwitchPM(text, startParam string) *ResultBuilder
- func (r *ResultBuilder) SwitchWebview(text, url string) *ResultBuilder
- type ResultOption
Constants ¶
const ( // PhotoType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultphoto. PhotoType = "photo" // ArticleType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultarticle. ArticleType = "article" // VideoType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultvideo. VideoType = "video" // AudioType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultaudio. AudioType = "audio" // DocumentType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultdocument. DocumentType = "document" // GIFType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultgif. GIFType = "gif" // MPEG4GIFType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif. MPEG4GIFType = "mpeg4_gif" // VoiceType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultvoice. VoiceType = "voice" // StickerType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultsticker. StickerType = "sticker" // LocationType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultlocation. LocationType = "location" // VenueType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultvenue. VenueType = "venue" // ContactType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultcontact. ContactType = "contact" // GameType is a type string of inline result. // See https://core.telegram.org/bots/api#inlinequeryresultgame. GameType = "game" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArticleResultBuilder ¶
type ArticleResultBuilder struct {
// contains filtered or unexported fields
}
ArticleResultBuilder is article result option builder.
func Article ¶
func Article(title string, msg MessageOption) *ArticleResultBuilder
Article creates article result option builder.
func (*ArticleResultBuilder) Content ¶
func (b *ArticleResultBuilder) Content(content tg.InputWebDocument) *ArticleResultBuilder
Content sets Result contents.
func (*ArticleResultBuilder) Description ¶
func (b *ArticleResultBuilder) Description(description string) *ArticleResultBuilder
Description sets Result description.
func (*ArticleResultBuilder) ID ¶
func (b *ArticleResultBuilder) ID(id string) *ArticleResultBuilder
ID sets ID of result. Should not be empty, so if id is not provided, random will be used.
func (*ArticleResultBuilder) Thumb ¶
func (b *ArticleResultBuilder) Thumb(thumb tg.InputWebDocument) *ArticleResultBuilder
Thumb sets Thumbnail for result.
func (*ArticleResultBuilder) Title ¶
func (b *ArticleResultBuilder) Title(title string) *ArticleResultBuilder
Title sets Result description.
func (*ArticleResultBuilder) URL ¶
func (b *ArticleResultBuilder) URL(url string) *ArticleResultBuilder
URL sets URL of result.
type DocumentResultBuilder ¶
type DocumentResultBuilder struct {
// contains filtered or unexported fields
}
DocumentResultBuilder is document result option builder.
func Audio ¶
func Audio(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
Audio creates audio result option builder.
func Document ¶
func Document(doc tg.InputDocumentClass, typ string, msg MessageOption) *DocumentResultBuilder
Document creates document result option builder.
func File ¶
func File(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
File creates document result option builder.
func GIF ¶
func GIF(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
GIF creates gif result option builder.
func MPEG4GIF ¶
func MPEG4GIF(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
MPEG4GIF creates mpeg4gif result option builder.
func Sticker ¶
func Sticker(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
Sticker creates sticker result option builder.
func Video ¶
func Video(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
Video creates video result option builder.
func Voice ¶
func Voice(doc tg.InputDocumentClass, msg MessageOption) *DocumentResultBuilder
Voice creates voice result option builder.
func (*DocumentResultBuilder) Description ¶
func (b *DocumentResultBuilder) Description(description string) *DocumentResultBuilder
Description sets Result description.
func (*DocumentResultBuilder) ID ¶
func (b *DocumentResultBuilder) ID(id string) *DocumentResultBuilder
ID sets ID of result. Should not be empty, so if id is not provided, random will be used.
func (*DocumentResultBuilder) Title ¶
func (b *DocumentResultBuilder) Title(title string) *DocumentResultBuilder
Title sets Result description.
type GameResultBuilder ¶
type GameResultBuilder struct {
// contains filtered or unexported fields
}
GameResultBuilder is game result option builder.
func Game ¶
func Game(shortName string, msg MessageOption) *GameResultBuilder
Game creates game result option builder.
func (*GameResultBuilder) ID ¶
func (b *GameResultBuilder) ID(id string) *GameResultBuilder
ID sets ID of result. Should not be empty, so if id is not provided, random will be used.
type MessageGameBuilder ¶
type MessageGameBuilder struct {
// contains filtered or unexported fields
}
MessageGameBuilder is a builder of inline result game message.
func MessageGame ¶
func MessageGame() *MessageGameBuilder
MessageGame creates new message option builder.
func (*MessageGameBuilder) Markup ¶
func (b *MessageGameBuilder) Markup(m tg.ReplyMarkupClass) *MessageGameBuilder
Markup sets reply markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.
func (*MessageGameBuilder) Row ¶
func (b *MessageGameBuilder) Row(buttons ...tg.KeyboardInlineButton) *MessageGameBuilder
Row sets single row keyboard markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.
type MessageMediaAutoBuilder ¶
type MessageMediaAutoBuilder struct {
// contains filtered or unexported fields
}
MessageMediaAutoBuilder is a builder of inline result text message.
func MediaAuto ¶
func MediaAuto(msg string) *MessageMediaAutoBuilder
MediaAuto creates new message text option builder.
func MediaAutoStyled ¶
func MediaAutoStyled(texts ...styling.StyledTextOption) *MessageMediaAutoBuilder
MediaAutoStyled creates new message text option builder.
func (*MessageMediaAutoBuilder) Markup ¶
func (b *MessageMediaAutoBuilder) Markup(m tg.ReplyMarkupClass) *MessageMediaAutoBuilder
Markup sets reply markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.
func (*MessageMediaAutoBuilder) Row ¶
func (b *MessageMediaAutoBuilder) Row( buttons ...tg.KeyboardInlineButton, ) *MessageMediaAutoBuilder
Row sets single row keyboard markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.
type MessageMediaGeoBuilder ¶
type MessageMediaGeoBuilder struct {
// contains filtered or unexported fields
}
MessageMediaGeoBuilder is a builder of inline result geo message.
func MessageGeo ¶
func MessageGeo(point tg.InputGeoPointClass) *MessageMediaGeoBuilder
MessageGeo creates new message geo option builder.
func (*MessageMediaGeoBuilder) Heading ¶
func (b *MessageMediaGeoBuilder) Heading(heading int) *MessageMediaGeoBuilder
Heading sets for live locations¹, a direction in which the location moves, in degrees; 1-360.
Links:
func (*MessageMediaGeoBuilder) Markup ¶
func (b *MessageMediaGeoBuilder) Markup(m tg.ReplyMarkupClass) *MessageMediaGeoBuilder
Markup sets reply markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.
func (*MessageMediaGeoBuilder) Period ¶
func (b *MessageMediaGeoBuilder) Period(dur time.Duration) *MessageMediaGeoBuilder
Period sets validity period.
func (*MessageMediaGeoBuilder) PeriodSeconds ¶
func (b *MessageMediaGeoBuilder) PeriodSeconds(period int) *MessageMediaGeoBuilder
PeriodSeconds sets validity period in seconds.
func (*MessageMediaGeoBuilder) ProximityNotificationRadius ¶
func (b *MessageMediaGeoBuilder) ProximityNotificationRadius(radius int) *MessageMediaGeoBuilder
ProximityNotificationRadius sets for live locations¹, a maximum distance to another chat member for proximity alerts, in meters (0-100000)
Links:
func (*MessageMediaGeoBuilder) Row ¶
func (b *MessageMediaGeoBuilder) Row(buttons ...tg.KeyboardInlineButton) *MessageMediaGeoBuilder
Row sets single row keyboard markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.
type MessageOption ¶
type MessageOption interface {
// contains filtered or unexported methods
}
MessageOption is an option of inline result message.
func ResultMessage ¶
func ResultMessage(r tg.InputBotInlineMessageClass) MessageOption
ResultMessage creates new MessageOption from given message object.
type MessageSharedWidgetBuilder ¶
type MessageSharedWidgetBuilder struct {
// contains filtered or unexported fields
}
MessageSharedWidgetBuilder is a builder of inline result shared widget message.
func MessageSharedWidget ¶
func MessageSharedWidget(id int64, caption ...styling.StyledTextOption) *MessageSharedWidgetBuilder
MessageSharedWidget creates new message option builder that sends an existing shared widget by its identifier, with optional caption.
func (*MessageSharedWidgetBuilder) ChatData ¶
func (b *MessageSharedWidgetBuilder) ChatData(data string) *MessageSharedWidgetBuilder
ChatData sets data of the widget, which is specific to the chat.
func (*MessageSharedWidgetBuilder) InvertMedia ¶
func (b *MessageSharedWidgetBuilder) InvertMedia(invert bool) *MessageSharedWidgetBuilder
InvertMedia sets flag to show the caption above the widget.
func (*MessageSharedWidgetBuilder) Markup ¶
func (b *MessageSharedWidgetBuilder) Markup(m tg.ReplyMarkupClass) *MessageSharedWidgetBuilder
Markup sets reply markup for sending bot buttons.
func (*MessageSharedWidgetBuilder) Row ¶
func (b *MessageSharedWidgetBuilder) Row(buttons ...tg.KeyboardInlineButton) *MessageSharedWidgetBuilder
Row sets single row keyboard markup for sending bot buttons.
type MessageTextBuilder ¶
type MessageTextBuilder struct {
// contains filtered or unexported fields
}
MessageTextBuilder is a builder of inline result text message.
func MessageStyledText ¶
func MessageStyledText(texts ...styling.StyledTextOption) *MessageTextBuilder
MessageStyledText creates new message text option builder.
func MessageText ¶
func MessageText(msg string) *MessageTextBuilder
MessageText creates new message text option builder.
func (*MessageTextBuilder) Markup ¶
func (b *MessageTextBuilder) Markup(m tg.ReplyMarkupClass) *MessageTextBuilder
Markup sets reply markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.
func (*MessageTextBuilder) NoWebpage ¶
func (b *MessageTextBuilder) NoWebpage() *MessageTextBuilder
NoWebpage sets flag to disable generation of the webpage preview.
func (*MessageTextBuilder) Row ¶
func (b *MessageTextBuilder) Row(buttons ...tg.KeyboardInlineButton) *MessageTextBuilder
Row sets single row keyboard markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.
type MessageWidgetBuilder ¶
type MessageWidgetBuilder struct {
// contains filtered or unexported fields
}
MessageWidgetBuilder is a builder of inline result HTML widget message.
func MessageWidget ¶
func MessageWidget(html string, caption ...styling.StyledTextOption) *MessageWidgetBuilder
MessageWidget creates new HTML widget message option builder with optional caption. The html is checked with widget.ValidateHTML; the compressed size limit is enforced by the server (see widget.ValidateCompressed).
Use it as content of a result, e.g. Article("Counter", MessageWidget(html)).
func (*MessageWidgetBuilder) AllowQueries ¶
func (b *MessageWidgetBuilder) AllowQueries(allow bool) *MessageWidgetBuilder
AllowQueries allows the widget to send queries to the bot (updateInlineBotWidgetQuery).
func (*MessageWidgetBuilder) ChatData ¶
func (b *MessageWidgetBuilder) ChatData(data string) *MessageWidgetBuilder
ChatData sets data of the widget, which is specific to the chat.
func (*MessageWidgetBuilder) InvertMedia ¶
func (b *MessageWidgetBuilder) InvertMedia(invert bool) *MessageWidgetBuilder
InvertMedia sets flag to show the caption above the widget.
func (*MessageWidgetBuilder) Markup ¶
func (b *MessageWidgetBuilder) Markup(m tg.ReplyMarkupClass) *MessageWidgetBuilder
Markup sets reply markup for sending bot buttons.
func (*MessageWidgetBuilder) PublicData ¶
func (b *MessageWidgetBuilder) PublicData(data string) *MessageWidgetBuilder
PublicData sets public data of the widget.
func (*MessageWidgetBuilder) Row ¶
func (b *MessageWidgetBuilder) Row(buttons ...tg.KeyboardInlineButton) *MessageWidgetBuilder
Row sets single row keyboard markup for sending bot buttons.
func (*MessageWidgetBuilder) Shared ¶
func (b *MessageWidgetBuilder) Shared(shared bool) *MessageWidgetBuilder
Shared makes the widget shared, so it can be sent again by its identifier.
func (*MessageWidgetBuilder) Size ¶
func (b *MessageWidgetBuilder) Size(width, height int) *MessageWidgetBuilder
Size sets widget width and height; zero width means full bubble width, zero height means that the height is not fixed.
type PhotoResultBuilder ¶
type PhotoResultBuilder struct {
// contains filtered or unexported fields
}
PhotoResultBuilder is photo result option builder.
func Photo ¶
func Photo(photo tg.InputPhotoClass, msg MessageOption) *PhotoResultBuilder
Photo creates game result option builder.
func (*PhotoResultBuilder) ID ¶
func (b *PhotoResultBuilder) ID(id string) *PhotoResultBuilder
ID sets ID of result. Should not be empty, so if id is not provided, random will be used.
type ResultBuilder ¶
type ResultBuilder struct {
// contains filtered or unexported fields
}
ResultBuilder is inline result builder.
func (*ResultBuilder) CacheTime ¶
func (r *ResultBuilder) CacheTime(cacheTime time.Duration) *ResultBuilder
CacheTime sets the maximum amount of time that the result of the inline query may be cached on the server. Server's default is 300 seconds.
func (*ResultBuilder) CacheTimeSeconds ¶
func (r *ResultBuilder) CacheTimeSeconds(cacheTime int) *ResultBuilder
CacheTimeSeconds sets the maximum amount of time in seconds that the result of the inline query may be cached on the server. Server's default is 300.
func (*ResultBuilder) Gallery ¶
func (r *ResultBuilder) Gallery(gallery bool) *ResultBuilder
Gallery sets flag if the results are composed of media files.
func (*ResultBuilder) NextOffset ¶
func (r *ResultBuilder) NextOffset(nextOffset string) *ResultBuilder
NextOffset sets offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes.
func (*ResultBuilder) Private ¶
func (r *ResultBuilder) Private(private bool) *ResultBuilder
Private sets flag if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.
func (*ResultBuilder) Set ¶
func (r *ResultBuilder) Set(ctx context.Context, opts ...ResultOption) (bool, error)
Set sets inline results for given query.
func (*ResultBuilder) SwitchPM ¶
func (r *ResultBuilder) SwitchPM(text, startParam string) *ResultBuilder
SwitchPM sets SwitchPm field.
If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter.
func (*ResultBuilder) SwitchWebview ¶ added in v0.85.0
func (r *ResultBuilder) SwitchWebview(text, url string) *ResultBuilder
SwitchWebview sets SwitchWebview field.
If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to the specified bot web app.
type ResultOption ¶
type ResultOption interface {
// contains filtered or unexported methods
}
ResultOption is an option of inline result.