botinput

package
v0.71.14 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2025 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBotInputTypeIdNameString added in v0.66.0

func GetBotInputTypeIdNameString(whInputType Type) string

Types

type Actor added in v0.66.0

type Actor interface {
	Platform() string // TODO: Consider removing this?
	GetID() any
	IsBotUser() bool
	GetFirstName() string
	GetLastName() string
	GetUserName() string
	GetLanguage() string
}

Actor represents sender

type Attachment added in v0.67.0

type Attachment interface {
	Type() string       // Enum(image, video, audio) for Facebook
	PayloadUrl() string // 'payload.url' for Facebook
}

Attachment represents attachment to a message

type AudioMessage added in v0.66.0

type AudioMessage interface {
	Message
}

AudioMessage represents a single audio message

type CallbackQuery added in v0.66.0

type CallbackQuery interface {
	GetID() string
	//GetInlineMessageID() string // Telegram only?
	//GetChatInstanceID() string  // Telegram only?
	GetFrom() Sender
	GetMessage() Message
	GetData() string
	Chat() Chat
}

CallbackQuery represents a single callback query message

type Chat added in v0.66.0

type Chat interface {
	GetID() string
	GetType() string
	IsGroupChat() bool
}

Chat represents botChat of a messenger

type ChosenInlineResult added in v0.66.0

type ChosenInlineResult interface {
	GetResultID() string
	GetInlineMessageID() string // Telegram only?
	GetFrom() Sender
	GetQuery() string
}

ChosenInlineResult represents a single report message on chosen inline result

type ContactMessage added in v0.66.0

type ContactMessage interface {
	GetPhoneNumber() string
	GetFirstName() string
	GetLastName() string
	GetBotUserID() string
	GetVCard() string
}

ContactMessage represents a single contact message

type ConversationStarted added in v0.66.0

type ConversationStarted interface {
	ConversationStartedMessage() any
}

ConversationStarted represents a single message about new conversation

type Delivery added in v0.66.0

type Delivery interface {
	Payload() string
}

Delivery represents a single delivery report message

type Entry added in v0.66.0

type Entry interface {
	GetID() any
	GetTime() time.Time
}

Entry represents a single message from a messenger user

type EntryInput added in v0.66.0

type EntryInput struct {
	Entry Entry
	Input InputMessage
}

EntryInput provides information on parsed input from bot API request

type EntryInputs added in v0.66.0

type EntryInputs struct {
	Entry  Entry
	Inputs []InputMessage
}

EntryInputs provides information on parsed inputs from bot API request

type InlineQuery added in v0.66.0

type InlineQuery interface {
	GetID() any
	GetInlineQueryID() string
	GetFrom() Sender
	GetQuery() string
	GetOffset() string
}

InlineQuery represents a single inline message

type InputMessage added in v0.66.0

type InputMessage interface {
	GetSender() User
	GetRecipient() Recipient
	GetTime() time.Time
	InputType() Type
	MessageIntID() int
	MessageStringID() string
	BotChatID() (string, error)
	Chat() Chat
	LogRequest() // TODO: should not be part of Input? If should - specify why
}

InputMessage represent a single message '/entry/messaging' for Facebook Messenger

type LeftChatMembersMessage added in v0.66.0

type LeftChatMembersMessage interface {
	BotChatID() (string, error)
	LeftChatMembers() []Actor
}

LeftChatMembersMessage represents a single message about a member leaving a botChat

type LocationMessage added in v0.70.2

type LocationMessage interface {
	Message
	GetLatitude() float64
	GetLongitude() float64
}

LocationMessage represents a location with geo point sent by user

type Message added in v0.66.0

type Message interface {
	InputMessage
	Chat() Chat
}

Message represents a single input message

type NewChatMembersMessage added in v0.66.0

type NewChatMembersMessage interface {
	BotChatID() (string, error)
	NewChatMembers() []Actor
}

NewChatMembersMessage represents a single message about a new member of a botChat

type OrderInfo added in v0.62.0

type OrderInfo interface {
	GetUserName() string //
	GetPhoneNumber() string
	GetEmailAddress() string
	GetShippingAddress() ShippingAddress
}

type PhotoMessage added in v0.66.0

type PhotoMessage interface {
	Message
}

PhotoMessage represents a single photo message

type PhotoMessageItem added in v0.41.0

type PhotoMessageItem interface {
	GetFileID() string
	GetFileUniqueID() string
	GetWidth() int
	GetHeight() int
	GetFileSize() int
}

type Postback added in v0.66.0

type Postback interface {
	PostbackMessage() any
	Payload() string
}

Postback represents a single postback message

type PreCheckoutQuery added in v0.67.0

type PreCheckoutQuery interface {
	GetPreCheckoutQueryID() string
	GetCurrency() string
	GetTotalAmount() int
	GetInvoicePayload() string
	GetFrom() Sender
	GetShippingOptionID() string
	GetOrderInfo() OrderInfo
}

type Recipient added in v0.66.0

type Recipient interface {
	Actor
}

Recipient represents receiver

type ReferralMessage added in v0.66.0

type ReferralMessage interface {
	Type() string
	Source() string
	RefData() string
}

ReferralMessage represents a single referral message https://developers.facebook.com/docs/messenger-platform/webhook-reference/referral

type RefundedPayment added in v0.67.0

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

type Sender added in v0.66.0

type Sender interface {
	GetAvatar() string // Extension to support avatar (Viber)
	Actor
}

Sender represents sender with avatar

type SharedUserMessageItem added in v0.41.0

type SharedUserMessageItem interface {
	GetBotUserID() string
	GetUsername() string
	GetFirstName() string
	GetLastName() string
	GetPhotos() []PhotoMessageItem
}

type SharedUsersMessage added in v0.67.0

type SharedUsersMessage interface {
	Message
	GetRequestID() int
	GetSharedUsers() []SharedUserMessageItem
}

SharedUsersMessage represents a message with information about shared user

type ShippingAddress added in v0.62.0

type ShippingAddress interface {
	GetCountryCode() string // Two-letter ISO 3166-1 alpha-2 country code
	GetState() string       // if applicable
	GetCity() string
	GetStreetLine1() string // First line for the address
	GetStreetLine2() string // Second line for the address
	GetPostCode() string
}

type StickerMessage added in v0.66.0

type StickerMessage interface {
	Message
}

StickerMessage represents single sticker message

type Subscribed added in v0.66.0

type Subscribed interface {
	SubscribedMessage() any
}

Subscribed represents a subscription message

type SuccessfulPayment added in v0.66.0

type SuccessfulPayment interface {
	GetSubscriptionExpirationDate() time.Time
	GetIsRecurring() bool
	GetIsFirstRecurring() bool
	GetShippingOptionID() string
	GetOrderInfo() OrderInfo
	// contains filtered or unexported methods
}

type TextMessage added in v0.66.0

type TextMessage interface {
	Message
	Text() string
	IsEdited() bool
}

TextMessage represents a single text message

type Type added in v0.66.0

type Type int

Type is enum of input type

const (
	// TypeUnknown is an unknown input type
	TypeUnknown Type = iota
	// TypeNotImplemented is not implemented input type
	TypeNotImplemented
	// TypeText is a text input type
	TypeText     // Facebook, Telegram, Viber
	TypeEditText // Facebook, Telegram, Viber
	// TypeVoice is voice input type
	TypeVoice
	// TypePhoto is a photo input type
	TypePhoto
	// TypeAudio is an audio input type
	TypeAudio
	// TypeContact is a contact input type
	TypeContact // Facebook, Telegram, Viber
	// TypePostback is unknown input type
	TypePostback
	// TypeDelivery is a postback input type
	TypeDelivery
	// TypeAttachment is a delivery report input type
	TypeAttachment
	// TypeInlineQuery is an attachment input type
	TypeInlineQuery // Telegram
	// TypeCallbackQuery is inline input type
	TypeCallbackQuery
	TypeLocation
	// TypeReferral is a callback input type
	TypeReferral // FBM
	// TypeChosenInlineResult is chosen inline result input type
	TypeChosenInlineResult // Telegram
	// TypeSubscribed is subscribed input type
	TypeSubscribed // Viber
	// TypeUnsubscribed is unsubscribed input type
	TypeUnsubscribed // Viber
	// TypeConversationStarted is conversation started input type
	TypeConversationStarted // Viber
	// TypeNewChatMembers is new botChat members input type
	TypeNewChatMembers // Telegram groups
	// TypeLeftChatMembers is left botChat members input type
	TypeLeftChatMembers
	// TypeSticker is a sticker input type
	TypeSticker
	TypeSharedUsers // Telegram
	TypePreCheckoutQuery
	TypeSuccessfulPayment
	TypeRefundedPayment
)

func (Type) String added in v0.67.0

func (i Type) String() string

type Unsubscribed added in v0.66.0

type Unsubscribed interface {
	UnsubscribedMessage() any
}

Unsubscribed represents a message when user unsubscribe

type User added in v0.66.0

type User interface {
	Sender

	// GetCountry is an extension to support language & country (Viber)
	GetCountry() string
}

User represents sender with country

type VoiceMessage added in v0.66.0

type VoiceMessage interface {
	Message
}

VoiceMessage represents a single voice message

Jump to

Keyboard shortcuts

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