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(button tg.KeyboardButtonClass, buttons ...tg.KeyboardButtonClass) *MessageMediaGeoBuilder
- type MessageOption
- type MessageTextBuilder
- 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, opt ResultOption, opts ...ResultOption) (bool, error)
- func (r *ResultBuilder) SwitchPM(text, startParam 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( button tg.KeyboardButtonClass, buttons ...tg.KeyboardButtonClass, ) *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( button tg.KeyboardButtonClass, buttons ...tg.KeyboardButtonClass, ) *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( button tg.KeyboardButtonClass, buttons ...tg.KeyboardButtonClass, ) *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 a option of inline result message.
func ResultMessage ¶
func ResultMessage(r tg.InputBotInlineMessageClass) MessageOption
ResultMessage creates new MessageOption from given message object.
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(button tg.KeyboardButtonClass, buttons ...tg.KeyboardButtonClass) *MessageTextBuilder
Row sets single row keyboard markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.
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, opt ResultOption, 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.
type ResultOption ¶
type ResultOption interface {
// contains filtered or unexported methods
}
ResultOption is a option of inline result.