inline

package
v0.0.0-...-f756a1e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package inline contains inline query results builder.

Index

Constants

View Source
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

Content sets Result contents.

func (*ArticleResultBuilder) Description

func (b *ArticleResultBuilder) Description(description string) *ArticleResultBuilder

Description sets Result description.

func (*ArticleResultBuilder) ID

ID sets ID of result. Should not be empty, so if id is not provided, random will be used.

func (*ArticleResultBuilder) Thumb

Thumb sets Thumbnail for result.

func (*ArticleResultBuilder) Title

Title sets Result description.

func (*ArticleResultBuilder) URL

URL sets URL of result.

type DocumentResultBuilder

type DocumentResultBuilder struct {
	// contains filtered or unexported fields
}

DocumentResultBuilder is document result option builder.

func Audio

Audio creates audio result option builder.

func Document

Document creates document result option builder.

func File

File creates document result option builder.

func GIF

GIF creates gif result option builder.

func MPEG4GIF

MPEG4GIF creates mpeg4gif result option builder.

func Sticker

Sticker creates sticker result option builder.

func Video

Video creates video result option builder.

func Voice

Voice creates voice result option builder.

func (*DocumentResultBuilder) Description

func (b *DocumentResultBuilder) Description(description string) *DocumentResultBuilder

Description sets Result description.

func (*DocumentResultBuilder) ID

ID sets ID of result. Should not be empty, so if id is not provided, random will be used.

func (*DocumentResultBuilder) Title

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

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

Markup sets reply markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.

func (*MessageGameBuilder) Row

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

Markup sets reply markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.

func (*MessageMediaAutoBuilder) Row

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:

  1. https://core.telegram.org/api/live-location

func (*MessageMediaGeoBuilder) Markup

Markup sets reply markup for sending bot buttons. NB: markup will not be used, if you send multiple media attachments.

func (*MessageMediaGeoBuilder) Period

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:

  1. https://core.telegram.org/api/live-location

func (*MessageMediaGeoBuilder) Row

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

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

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

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

Photo creates game result option builder.

func (*PhotoResultBuilder) ID

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 New

func New(raw *tg.Client, random io.Reader, queryID int64) *ResultBuilder

New creates new ResultBuilder.

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.

type ResultOption

type ResultOption interface {
	// contains filtered or unexported methods
}

ResultOption is an option of inline result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL