botmsg

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const NoMessageToSend = "<NO_MESSAGE_TO_SEND>"

NoMessageToSend returned explicitly if we don't want to reply to user intput

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment interface {
	AttachmentType() AttachmentType
}

Attachment to a bot message

type AttachmentType

type AttachmentType int

AttachmentType to a bot message

const (
	// AttachmentTypeNone says there is no attachment
	AttachmentTypeNone AttachmentType = iota

	// AttachmentTypeAudio is for audio attachments
	AttachmentTypeAudio

	// AttachmentTypeFile is for file attachments
	AttachmentTypeFile

	// AttachmentTypeImage is for image attachments
	AttachmentTypeImage

	// AttachmentTypeVideo is for video attachments
	AttachmentTypeVideo
)

type BotAPISendMessageChannel

type BotAPISendMessageChannel string

BotAPISendMessageChannel specifies messenger channel

type BotMessage

type BotMessage interface {
	BotMessageType() Type
}

BotMessage is an output message from bot to user

type ChatIntID

type ChatIntID int64

ChatIntID returns botChat ID as unique integer

func (ChatIntID) ChatUID

func (chatUID ChatIntID) ChatUID() string

ChatUID returns botChat ID as unique string

type ChatUID

type ChatUID interface {
	ChatUID() string
}

ChatUID returns botChat ID as unique string

type Format

type Format int

Format specifies formatting of a text message to BOT (e.g. TypeText, HTML, MarkDown)

const (
	// FormatText is for text messages
	FormatText Format = iota
	// FormatHTML is for HTML messages
	FormatHTML
	// FormatMarkdown is for markdown messages
	FormatMarkdown
)

type MessageFromBot

type MessageFromBot struct {
	ResponseChannel BotAPISendMessageChannel `json:"-,omitempty"` // For debug purposes
	ToChat          ChatUID                  `json:",omitempty"`

	// To be used with Telegram to edit an arbitrary message.
	// Do not use this field directly when you want to edit the callback message
	EditMessageIntID int `json:"editMessageIntID,omitempty"`

	// This is a shortcut to MessageFromBot{}.BotMessage = TextMessageFromBot{text: "abc"}
	TextMessageFromBot // TODO: This feels wrong and need to be refactored! Use BotMessage instead

	BotMessage BotMessage `json:",omitempty"`
}

MessageFromBot keeps all the details of answer from bot to user

type MessageUID

type MessageUID interface {
	UID() string
}

MessageUID is unique message ID as string

type TextMessageFromBot

type TextMessageFromBot struct {
	Text                  string         `json:",omitempty"`
	Format                Format         `json:",omitempty"`
	DisableWebPagePreview bool           `json:",omitempty"`
	DisableNotification   bool           `json:",omitempty"`
	Keyboard              botkb.Keyboard `json:",omitempty"`
	IsEdit                bool           `json:",omitempty"`
	EditMessageUID        MessageUID     `json:",omitempty"`
}

TextMessageFromBot is a text output message from bot to user

func (*TextMessageFromBot) BotEndpoint

func (m *TextMessageFromBot) BotEndpoint() string

func (*TextMessageFromBot) BotMessageType

func (m *TextMessageFromBot) BotMessageType() Type

Type returns if we want to send a new message or edit existing one

type Type

type Type int

Type defines a type of output message from bot to user

const (
	// TypeUndefined unknown type
	TypeUndefined Type = iota
	// TypeCallbackAnswer sends a callback answer
	TypeCallbackAnswer
	// BotMessageTypeInlineResults sends inline results
	BotMessageTypeInlineResults
	// TypeText sends text reply
	TypeText
	// TypeEditMessage edit previously sent message
	TypeEditMessage
	// TypeLeaveChat commands messenger to kick off bot from a botChat
	TypeLeaveChat
	// TypeExportChatInviteLink sends invite link
	TypeExportChatInviteLink

	TypeSendPhoto

	TypeSendInvoice
	TypeCreateInvoiceLink
	TypeAnswerPreCheckoutQuery

	TypeSetDescription
	TypeSetShortDescription
	TypeSetCommands
)

Jump to

Keyboard shortcuts

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