engine

package
v0.0.0-...-2b16ddc Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChatPhotoPNG = func() []byte {
	img := image.NewRGBA(image.Rect(0, 0, 160, 160))
	red := color.RGBA{R: 255, G: 0, B: 0, A: 255}
	for y := 0; y < 160; y++ {
		for x := 0; x < 160; x++ {
			img.Set(x, y, red)
		}
	}
	var buf bytes.Buffer
	_ = png.Encode(&buf, img)
	return buf.Bytes()
}()

ChatPhotoPNG is a 160x160 red PNG suitable for setChatPhoto. Telegram requires chat photos to be at least 160x160 pixels.

View Source
var MinimalPNG = []byte{
	0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,
	0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
	0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
	0x08, 0x02, 0x00, 0x00, 0x00, 0x90, 0x77, 0x53,
	0xde, 0x00, 0x00, 0x00, 0x0c, 0x49, 0x44, 0x41,
	0x54, 0x08, 0xd7, 0x63, 0xf8, 0xcf, 0xc0, 0x00,
	0x00, 0x03, 0x01, 0x01, 0x00, 0x18, 0xdd, 0x8d,
	0xb0, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
	0x44, 0xae, 0x42, 0x60, 0x82,
}

MinimalPNG is a valid 1x1 red pixel PNG (67 bytes). Too small for chat photos — use ChatPhotoPNG instead.

Functions

func IsSkip

func IsSkip(err error) bool

IsSkip returns true if err is a SkipError.

func RequireAdmin

func RequireAdmin(ctx context.Context, rt *Runtime) error

RequireAdmin skips if bot is not admin.

func RequireCanChangeInfo

func RequireCanChangeInfo(ctx context.Context, rt *Runtime) error

RequireCanChangeInfo skips if bot can't change chat info.

func RequireCanDeleteMessages

func RequireCanDeleteMessages(ctx context.Context, rt *Runtime) error

RequireCanDeleteMessages skips if bot can't delete messages.

func RequireCanManageTopics

func RequireCanManageTopics(ctx context.Context, rt *Runtime) error

RequireCanManageTopics skips if bot can't manage forum topics.

func RequireCanRestrict

func RequireCanRestrict(ctx context.Context, rt *Runtime) error

RequireCanRestrict skips if bot can't restrict members.

func RequireForum

func RequireForum(ctx context.Context, rt *Runtime) error

RequireForum skips if chat is not a forum.

func RequireForumChatID

func RequireForumChatID(rt *Runtime) error

RequireForumChatID skips if ForumChatID is not configured.

func RequireTestUser

func RequireTestUser(rt *Runtime) error

RequireTestUser skips if TestUserID is not configured.

func Skip

func Skip(reason string) error

Skip returns a SkipError with the given reason.

Types

type AddStickerToSetStep

type AddStickerToSetStep struct {
	Sticker StickerInput
}

AddStickerToSetStep adds a sticker to the tracked set.

func (*AddStickerToSetStep) Execute

func (s *AddStickerToSetStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*AddStickerToSetStep) Name

func (s *AddStickerToSetStep) Name() string

type AnswerCallbackQueryStep

type AnswerCallbackQueryStep struct {
	Text      string
	ShowAlert bool
}

AnswerCallbackQueryStep answers the last received callback query.

func (*AnswerCallbackQueryStep) Execute

func (*AnswerCallbackQueryStep) Name

func (s *AnswerCallbackQueryStep) Name() string

type BaseScenario

type BaseScenario struct {
	ScenarioName        string
	ScenarioDescription string
	CoveredMethods      []string
	ScenarioSteps       []Step
	ScenarioTimeout     time.Duration
}

BaseScenario provides common implementation.

func (*BaseScenario) Covers

func (s *BaseScenario) Covers() []string

func (*BaseScenario) Description

func (s *BaseScenario) Description() string

func (*BaseScenario) Name

func (s *BaseScenario) Name() string

func (*BaseScenario) Steps

func (s *BaseScenario) Steps() []Step

func (*BaseScenario) Timeout

func (s *BaseScenario) Timeout() time.Duration

type ButtonDef

type ButtonDef struct {
	Text              string
	CallbackData      string
	Style             string // 9.4: "danger", "success", "primary"
	IconCustomEmojiID string // 9.4: custom emoji ID for button icon
}

ButtonDef defines a button for inline keyboards.

type ChatContext

type ChatContext struct {
	ChatID   int64
	ChatType string // "private", "group", "supergroup", "channel"
	IsForum  bool

	// Bot capabilities (probed via getChatMember)
	BotIsAdmin         bool
	CanChangeInfo      bool
	CanDeleteMessages  bool
	CanRestrictMembers bool
	CanPinMessages     bool
	CanManageTopics    bool
	CanInviteUsers     bool
}

ChatContext holds probed chat capabilities.

type ChatPhotoSnapshot

type ChatPhotoSnapshot struct {
	HadPhoto bool
	FileID   string // BigFileID for restore via FromFileID
}

ChatPhotoSnapshot stores state for restore.

type ChecklistTaskInput

type ChecklistTaskInput struct {
	ID   int
	Text string
	Done bool
}

ChecklistTaskInput represents a task in a checklist edit.

type CleanupStep

type CleanupStep struct{}

CleanupStep deletes all tracked messages.

func (*CleanupStep) Execute

func (s *CleanupStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*CleanupStep) Name

func (s *CleanupStep) Name() string

type CopyMessageStep

type CopyMessageStep struct {
	ToChatID int64 // If 0, uses rt.ChatID
}

CopyMessageStep copies the last message.

func (*CopyMessageStep) Execute

func (s *CopyMessageStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*CopyMessageStep) Name

func (s *CopyMessageStep) Name() string

type CopyMessagesStep

type CopyMessagesStep struct{}

CopyMessagesStep copies messages from BulkMessageIDs.

func (*CopyMessagesStep) Execute

func (s *CopyMessagesStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*CopyMessagesStep) Name

func (s *CopyMessagesStep) Name() string

type CreateStickerSetStep

type CreateStickerSetStep struct {
	NameSuffix string // Appended to bot username to form full set name
	Title      string
	Stickers   []StickerInput
}

CreateStickerSetStep creates a new sticker set and tracks it for cleanup.

func (*CreateStickerSetStep) Execute

func (s *CreateStickerSetStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*CreateStickerSetStep) Name

func (s *CreateStickerSetStep) Name() string

type CreatedMessage

type CreatedMessage struct {
	ChatID    int64
	MessageID int
}

CreatedMessage tracks messages for cleanup.

type DeleteLastMessageStep

type DeleteLastMessageStep struct{}

DeleteLastMessageStep deletes the last sent message.

func (*DeleteLastMessageStep) Execute

func (s *DeleteLastMessageStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*DeleteLastMessageStep) Name

func (s *DeleteLastMessageStep) Name() string

type DeleteMessagesStep

type DeleteMessagesStep struct{}

DeleteMessagesStep deletes all tracked messages for this chat at once.

func (*DeleteMessagesStep) Execute

func (s *DeleteMessagesStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*DeleteMessagesStep) Name

func (s *DeleteMessagesStep) Name() string

type DeleteMyCommandsStep

type DeleteMyCommandsStep struct{}

DeleteMyCommandsStep removes the bot's command list.

func (*DeleteMyCommandsStep) Execute

func (s *DeleteMyCommandsStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*DeleteMyCommandsStep) Name

func (s *DeleteMyCommandsStep) Name() string

type DeleteStickerFromSetStep

type DeleteStickerFromSetStep struct{}

DeleteStickerFromSetStep deletes the captured sticker from the set.

func (*DeleteStickerFromSetStep) Execute

func (*DeleteStickerFromSetStep) Name

func (s *DeleteStickerFromSetStep) Name() string

type DeleteStickerSetStep

type DeleteStickerSetStep struct{}

DeleteStickerSetStep deletes the tracked sticker set.

func (*DeleteStickerSetStep) Execute

func (s *DeleteStickerSetStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*DeleteStickerSetStep) Name

func (s *DeleteStickerSetStep) Name() string

type DeleteWebhookStep

type DeleteWebhookStep struct{}

DeleteWebhookStep removes the webhook.

func (*DeleteWebhookStep) Execute

func (s *DeleteWebhookStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*DeleteWebhookStep) Name

func (s *DeleteWebhookStep) Name() string

type EditMessageCaptionStep

type EditMessageCaptionStep struct {
	Caption string
}

EditMessageCaptionStep edits the caption of the last message.

func (*EditMessageCaptionStep) Execute

func (s *EditMessageCaptionStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*EditMessageCaptionStep) Name

func (s *EditMessageCaptionStep) Name() string

type EditMessageChecklistStep

type EditMessageChecklistStep struct {
	Title string
	Tasks []ChecklistTaskInput
}

EditMessageChecklistStep edits the last checklist message.

func (*EditMessageChecklistStep) Execute

func (*EditMessageChecklistStep) Name

func (s *EditMessageChecklistStep) Name() string

type EditMessageMediaStep

type EditMessageMediaStep struct {
	Media sender.InputMedia
}

EditMessageMediaStep edits the media content of the last message.

func (*EditMessageMediaStep) Execute

func (s *EditMessageMediaStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*EditMessageMediaStep) Name

func (s *EditMessageMediaStep) Name() string

type EditMessageReplyMarkupStep

type EditMessageReplyMarkupStep struct {
	Buttons []ButtonDef // nil = remove keyboard
}

EditMessageReplyMarkupStep edits the reply markup of the last message.

func (*EditMessageReplyMarkupStep) Execute

func (*EditMessageReplyMarkupStep) Name

type EditMessageTextStep

type EditMessageTextStep struct {
	Text string
}

EditMessageTextStep edits the last message's text.

func (*EditMessageTextStep) Execute

func (s *EditMessageTextStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*EditMessageTextStep) Name

func (s *EditMessageTextStep) Name() string

type ForwardMessageStep

type ForwardMessageStep struct {
	ToChatID int64 // If 0, uses rt.ChatID
}

ForwardMessageStep forwards the last message.

func (*ForwardMessageStep) Execute

func (s *ForwardMessageStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*ForwardMessageStep) Name

func (s *ForwardMessageStep) Name() string

type ForwardMessagesStep

type ForwardMessagesStep struct{}

ForwardMessagesStep forwards messages from BulkMessageIDs.

func (*ForwardMessagesStep) Execute

func (s *ForwardMessagesStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*ForwardMessagesStep) Name

func (s *ForwardMessagesStep) Name() string

type GetAvailableGiftsStep

type GetAvailableGiftsStep struct{}

GetAvailableGiftsStep gets available gifts.

func (*GetAvailableGiftsStep) Execute

func (s *GetAvailableGiftsStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetAvailableGiftsStep) Name

func (s *GetAvailableGiftsStep) Name() string

type GetChatAdministratorsStep

type GetChatAdministratorsStep struct{}

GetChatAdministratorsStep gets chat admins.

func (*GetChatAdministratorsStep) Execute

func (*GetChatAdministratorsStep) Name

type GetChatMemberCountStep

type GetChatMemberCountStep struct{}

GetChatMemberCountStep gets member count.

func (*GetChatMemberCountStep) Execute

func (s *GetChatMemberCountStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetChatMemberCountStep) Name

func (s *GetChatMemberCountStep) Name() string

type GetChatMemberStep

type GetChatMemberStep struct {
	UserID int64 // If 0, uses bot's own ID from GetMe
}

GetChatMemberStep gets info about a specific member (the bot itself).

func (*GetChatMemberStep) Execute

func (s *GetChatMemberStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetChatMemberStep) Name

func (s *GetChatMemberStep) Name() string

type GetChatStep

type GetChatStep struct{}

GetChatStep gets full chat info.

func (*GetChatStep) Execute

func (s *GetChatStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetChatStep) Name

func (s *GetChatStep) Name() string

type GetFileStep

type GetFileStep struct {
	FileKey string // Key in CapturedFileIDs (e.g., "photo", "document")
}

GetFileStep gets file info for a captured file.

func (*GetFileStep) Execute

func (s *GetFileStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetFileStep) Name

func (s *GetFileStep) Name() string

type GetForumTopicIconStickersStep

type GetForumTopicIconStickersStep struct{}

GetForumTopicIconStickersStep gets forum topic icon stickers.

func (*GetForumTopicIconStickersStep) Execute

func (*GetForumTopicIconStickersStep) Name

type GetMeStep

type GetMeStep struct{}

GetMeStep verifies bot identity.

func (*GetMeStep) Execute

func (s *GetMeStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetMeStep) Name

func (s *GetMeStep) Name() string

type GetMyCommandsStep

type GetMyCommandsStep struct {
	ExpectedCount int // If > 0, assert this many commands
}

GetMyCommandsStep gets the bot's command list.

func (*GetMyCommandsStep) Execute

func (s *GetMyCommandsStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetMyCommandsStep) Name

func (s *GetMyCommandsStep) Name() string

type GetMyDefaultAdministratorRightsStep

type GetMyDefaultAdministratorRightsStep struct {
	ForChannels bool
}

GetMyDefaultAdministratorRightsStep gets the bot's default admin rights.

func (*GetMyDefaultAdministratorRightsStep) Execute

func (*GetMyDefaultAdministratorRightsStep) Name

type GetMyDescriptionStep

type GetMyDescriptionStep struct{}

GetMyDescriptionStep gets the bot's description.

func (*GetMyDescriptionStep) Execute

func (s *GetMyDescriptionStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetMyDescriptionStep) Name

func (s *GetMyDescriptionStep) Name() string

type GetMyNameStep

type GetMyNameStep struct {
	ExpectedName string // If non-empty, assert this name
}

GetMyNameStep gets the bot's name.

func (*GetMyNameStep) Execute

func (s *GetMyNameStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetMyNameStep) Name

func (s *GetMyNameStep) Name() string

type GetMyShortDescriptionStep

type GetMyShortDescriptionStep struct{}

GetMyShortDescriptionStep gets the bot's short description.

func (*GetMyShortDescriptionStep) Execute

func (*GetMyShortDescriptionStep) Name

type GetMyStarBalanceStep

type GetMyStarBalanceStep struct{}

GetMyStarBalanceStep gets the bot's Star balance.

func (*GetMyStarBalanceStep) Execute

func (s *GetMyStarBalanceStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetMyStarBalanceStep) Name

func (s *GetMyStarBalanceStep) Name() string

type GetStarTransactionsStep

type GetStarTransactionsStep struct {
	Limit int
}

GetStarTransactionsStep gets recent Star transactions.

func (*GetStarTransactionsStep) Execute

func (*GetStarTransactionsStep) Name

func (s *GetStarTransactionsStep) Name() string

type GetStickerSetStep

type GetStickerSetStep struct{}

GetStickerSetStep gets a sticker set (uses the name from CapturedFileIDs).

func (*GetStickerSetStep) Execute

func (s *GetStickerSetStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetStickerSetStep) Name

func (s *GetStickerSetStep) Name() string

type GetUpdatesStep

type GetUpdatesStep struct{}

GetUpdatesStep calls getUpdates with timeout=0 (non-blocking).

func (*GetUpdatesStep) Execute

func (s *GetUpdatesStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetUpdatesStep) Name

func (s *GetUpdatesStep) Name() string

type GetUserChatBoostsStep

type GetUserChatBoostsStep struct{}

GetUserChatBoostsStep gets a user's boosts in the chat.

func (*GetUserChatBoostsStep) Execute

func (s *GetUserChatBoostsStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetUserChatBoostsStep) Name

func (s *GetUserChatBoostsStep) Name() string

type GetUserProfileAudiosStep

type GetUserProfileAudiosStep struct{}

GetUserProfileAudiosStep gets profile audios of a user (9.4).

func (*GetUserProfileAudiosStep) Execute

func (*GetUserProfileAudiosStep) Name

func (s *GetUserProfileAudiosStep) Name() string

type GetUserProfilePhotosStep

type GetUserProfilePhotosStep struct{}

GetUserProfilePhotosStep gets profile photos of a user.

func (*GetUserProfilePhotosStep) Execute

func (*GetUserProfilePhotosStep) Name

func (s *GetUserProfilePhotosStep) Name() string

type GetWebhookInfoStep

type GetWebhookInfoStep struct {
	StoreAs string // If set, stores the webhook URL in CapturedFileIDs[StoreAs]
}

GetWebhookInfoStep retrieves webhook info and optionally stores the URL for restore.

func (*GetWebhookInfoStep) Execute

func (s *GetWebhookInfoStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*GetWebhookInfoStep) Name

func (s *GetWebhookInfoStep) Name() string

type MediaInput

type MediaInput struct {
	Reader   func() []byte // Factory to get fresh bytes (can be called multiple times)
	FileName string
	FileID   string
	URL      string
	Type     string // "photo", "video", "document", etc.
}

MediaInput represents a file input for media uploads. Use one of: FromReader, FromFileID, FromURL.

func MediaFromBytes

func MediaFromBytes(data []byte, filename, mediaType string) MediaInput

MediaFromBytes creates a MediaInput from bytes.

func MediaFromFileID

func MediaFromFileID(fileID string) MediaInput

MediaFromFileID creates a MediaInput from a file ID.

func MediaFromURL

func MediaFromURL(url string) MediaInput

MediaFromURL creates a MediaInput from a URL.

type PermissionsSnapshot

type PermissionsSnapshot struct {
	Permissions *tg.ChatPermissions
}

PermissionsSnapshot stores permissions for restore.

type PinChatMessageStep

type PinChatMessageStep struct {
	Silent bool
}

PinChatMessageStep pins the last sent message.

func (*PinChatMessageStep) Execute

func (s *PinChatMessageStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*PinChatMessageStep) Name

func (s *PinChatMessageStep) Name() string

type RestoreChatPermissionsStep

type RestoreChatPermissionsStep struct{}

RestoreChatPermissionsStep restores original permissions.

func (*RestoreChatPermissionsStep) Execute

func (*RestoreChatPermissionsStep) Name

type RestoreChatPhotoStep

type RestoreChatPhotoStep struct{}

RestoreChatPhotoStep restores the original photo using FromFileID.

func (*RestoreChatPhotoStep) Execute

func (s *RestoreChatPhotoStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*RestoreChatPhotoStep) Name

func (s *RestoreChatPhotoStep) Name() string

type RestoreChatTitleStep

type RestoreChatTitleStep struct{}

RestoreChatTitleStep restores the saved chat title and description.

func (*RestoreChatTitleStep) Execute

func (s *RestoreChatTitleStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*RestoreChatTitleStep) Name

func (s *RestoreChatTitleStep) Name() string

type RestoreWebhookStep

type RestoreWebhookStep struct {
	StoredKey string // Key in CapturedFileIDs to read the original URL from
}

RestoreWebhookStep restores a previously saved webhook URL. If the stored URL is empty, it deletes the webhook instead.

func (*RestoreWebhookStep) Execute

func (s *RestoreWebhookStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*RestoreWebhookStep) Name

func (s *RestoreWebhookStep) Name() string

type Runner

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

Runner executes scenarios with safety limits.

func NewRunner

func NewRunner(rt *Runtime, cfg RunnerConfig, logger *slog.Logger) *Runner

NewRunner creates a new scenario runner.

func (*Runner) MessageCount

func (r *Runner) MessageCount() int

MessageCount returns the number of messages sent.

func (*Runner) ResetMessageCount

func (r *Runner) ResetMessageCount()

ResetMessageCount resets the message counter (for new runs).

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, scenario Scenario) *ScenarioResult

Run executes a scenario and returns the result.

func (*Runner) Runtime

func (r *Runner) Runtime() *Runtime

Runtime returns the runner's runtime for access to state.

type RunnerConfig

type RunnerConfig struct {
	BaseDelay     time.Duration
	Jitter        time.Duration
	MaxMessages   int
	RetryOn429    bool
	Max429Retries int
}

RunnerConfig holds runner configuration.

type Runtime

type Runtime struct {
	Sender SenderClient
	ChatID int64

	// AdminUserID is a human user ID for operations that require a real user (e.g. createNewStickerSet).
	AdminUserID int64

	// State shared between steps
	CreatedMessages    []CreatedMessage
	LastMessage        *tg.Message
	LastMessageID      *tg.MessageID
	BulkMessageIDs     []int             // For bulk operations
	CapturedFileIDs    map[string]string // name -> file_id for reuse
	CreatedStickerSets []string          // sticker set names to clean up

	// Probed capabilities
	ChatCtx *ChatContext

	// Snapshots for save/restore
	OriginalChatPhoto   *ChatPhotoSnapshot
	OriginalPermissions *PermissionsSnapshot

	// Optional chat IDs from config
	ForumChatID int64
	TestUserID  int64

	// CallbackChan receives callback queries from polling (interactive scenarios only).
	CallbackChan chan *tg.CallbackQuery
}

Runtime provides context for step execution.

func NewRuntime

func NewRuntime(sender SenderClient, chatID int64, adminUserID int64) *Runtime

NewRuntime creates a new runtime for scenario execution.

func (*Runtime) ProbeChat

func (rt *Runtime) ProbeChat(ctx context.Context) error

ProbeChat discovers chat capabilities by calling getChat and getChatMember.

func (*Runtime) TrackMessage

func (rt *Runtime) TrackMessage(chatID int64, messageID int)

TrackMessage adds a message to the cleanup list.

func (*Runtime) TrackStickerSet

func (rt *Runtime) TrackStickerSet(name string)

TrackStickerSet adds a sticker set name to the cleanup list.

type SaveChatPermissionsStep

type SaveChatPermissionsStep struct{}

SaveChatPermissionsStep saves the current permissions for restore.

func (*SaveChatPermissionsStep) Execute

func (*SaveChatPermissionsStep) Name

func (s *SaveChatPermissionsStep) Name() string

type SaveChatPhotoStep

type SaveChatPhotoStep struct{}

SaveChatPhotoStep saves the current photo's file_id for restore.

func (*SaveChatPhotoStep) Execute

func (s *SaveChatPhotoStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SaveChatPhotoStep) Name

func (s *SaveChatPhotoStep) Name() string

type SaveChatTitleStep

type SaveChatTitleStep struct{}

SaveChatTitleStep saves the current chat title in CapturedFileIDs for later restore.

func (*SaveChatTitleStep) Execute

func (s *SaveChatTitleStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SaveChatTitleStep) Name

func (s *SaveChatTitleStep) Name() string

type Scenario

type Scenario interface {
	Name() string
	Description() string
	Covers() []string // Methods this scenario exercises
	Steps() []Step
	Timeout() time.Duration
}

Scenario is a named sequence of steps that declares method coverage.

type ScenarioResult

type ScenarioResult struct {
	ScenarioName string        `json:"scenario_name"`
	Covers       []string      `json:"covers"`
	StartTime    time.Time     `json:"start_time"`
	EndTime      time.Time     `json:"end_time"`
	Duration     time.Duration `json:"duration"`
	Success      bool          `json:"success"`
	Skipped      bool          `json:"skipped,omitempty"`
	SkipReason   string        `json:"skip_reason,omitempty"`
	Error        string        `json:"error,omitempty"`
	Steps        []StepResult  `json:"steps"`
}

ScenarioResult captures the result of running a scenario.

type SeedMessagesStep

type SeedMessagesStep struct {
	Count int // Default: 3
}

SeedMessagesStep sends N messages and stores their IDs for bulk operations.

func (*SeedMessagesStep) Execute

func (s *SeedMessagesStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SeedMessagesStep) Name

func (s *SeedMessagesStep) Name() string

type SendAnimationStep

type SendAnimationStep struct {
	Animation MediaInput
	Caption   string
}

SendAnimationStep sends an animation (GIF).

func (*SendAnimationStep) Execute

func (s *SendAnimationStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendAnimationStep) Name

func (s *SendAnimationStep) Name() string

type SendAudioStep

type SendAudioStep struct {
	Audio   MediaInput
	Caption string
}

SendAudioStep sends an audio file.

func (*SendAudioStep) Execute

func (s *SendAudioStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendAudioStep) Name

func (s *SendAudioStep) Name() string

type SendChatActionStep

type SendChatActionStep struct {
	Action string // e.g., "typing"
}

SendChatActionStep sends a chat action.

func (*SendChatActionStep) Execute

func (s *SendChatActionStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendChatActionStep) Name

func (s *SendChatActionStep) Name() string

type SendChecklistStep

type SendChecklistStep struct {
	Title string
	Tasks []string
}

SendChecklistStep sends a checklist message.

func (*SendChecklistStep) Execute

func (s *SendChecklistStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendChecklistStep) Name

func (s *SendChecklistStep) Name() string

type SendContactStep

type SendContactStep struct {
	PhoneNumber string
	FirstName   string
	LastName    string
}

SendContactStep sends a phone contact.

func (*SendContactStep) Execute

func (s *SendContactStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendContactStep) Name

func (s *SendContactStep) Name() string

type SendDiceStep

type SendDiceStep struct {
	Emoji string // 🎲 🎯 🏀 ⚽ 🎳 🎰
}

SendDiceStep sends an animated dice/emoji.

func (*SendDiceStep) Execute

func (s *SendDiceStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendDiceStep) Name

func (s *SendDiceStep) Name() string

type SendDocumentStep

type SendDocumentStep struct {
	Document MediaInput
	Caption  string
}

SendDocumentStep sends a document.

func (*SendDocumentStep) Execute

func (s *SendDocumentStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendDocumentStep) Name

func (s *SendDocumentStep) Name() string

type SendFormattedMessageStep

type SendFormattedMessageStep struct {
	Text      string
	ParseMode string // "Markdown", "MarkdownV2", "HTML"
}

SendFormattedMessageStep sends a text message with ParseMode. This validates that named string types (tg.ParseMode) serialize correctly. See: https://github.com/prilive-com/galigo/issues/5

func (*SendFormattedMessageStep) Execute

func (*SendFormattedMessageStep) Name

func (s *SendFormattedMessageStep) Name() string

type SendInvoiceStep

type SendInvoiceStep struct {
	Title       string
	Description string
	Payload     string
	Currency    string
	Prices      []tg.LabeledPrice
}

SendInvoiceStep sends an invoice message.

func (*SendInvoiceStep) Execute

func (s *SendInvoiceStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendInvoiceStep) Name

func (s *SendInvoiceStep) Name() string

type SendLocationStep

type SendLocationStep struct {
	Latitude  float64
	Longitude float64
}

SendLocationStep sends a GPS location.

func (*SendLocationStep) Execute

func (s *SendLocationStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendLocationStep) Name

func (s *SendLocationStep) Name() string

type SendMediaGroupStep

type SendMediaGroupStep struct {
	Media []MediaInput
}

SendMediaGroupStep sends a media group (album).

func (*SendMediaGroupStep) Execute

func (s *SendMediaGroupStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendMediaGroupStep) Name

func (s *SendMediaGroupStep) Name() string

type SendMessageStep

type SendMessageStep struct {
	Text string
}

SendMessageStep sends a text message.

func (*SendMessageStep) Execute

func (s *SendMessageStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendMessageStep) Name

func (s *SendMessageStep) Name() string

type SendMessageWithKeyboardStep

type SendMessageWithKeyboardStep struct {
	Text    string
	Buttons []ButtonDef
}

SendMessageWithKeyboardStep sends a message with an inline keyboard.

func (*SendMessageWithKeyboardStep) Execute

func (*SendMessageWithKeyboardStep) Name

type SendMessageWithLinkPreviewStep

type SendMessageWithLinkPreviewStep struct {
	Text               string
	LinkPreviewOptions *tg.LinkPreviewOptions
}

SendMessageWithLinkPreviewStep sends a message with LinkPreviewOptions. This validates that link_preview_options serializes correctly and is accepted by Telegram. NOTE: We do NOT assert on preview rendering (whether it shows up, size, position) since link_preview_options are rendering hints that Telegram may ignore. See: https://github.com/prilive-com/galigo/issues/6

func (*SendMessageWithLinkPreviewStep) Execute

func (*SendMessageWithLinkPreviewStep) Name

type SendMessageWithStyledButtonsStep

type SendMessageWithStyledButtonsStep struct {
	Text    string
	Buttons []ButtonDef // Use Style and IconCustomEmojiID fields
}

SendMessageWithStyledButtonsStep sends a message with 9.4 styled buttons.

func (*SendMessageWithStyledButtonsStep) Execute

func (*SendMessageWithStyledButtonsStep) Name

type SendOption

type SendOption func(*SendOptions)

SendOption configures message sending.

func WithCaption

func WithCaption(caption string) SendOption

WithCaption sets the caption for media messages.

func WithLinkPreviewOptions

func WithLinkPreviewOptions(opts *tg.LinkPreviewOptions) SendOption

WithLinkPreviewOptions sets link preview options for sendMessage.

func WithParseMode

func WithParseMode(mode string) SendOption

WithParseMode sets the parse mode.

func WithReplyMarkup

func WithReplyMarkup(markup *tg.InlineKeyboardMarkup) SendOption

WithReplyMarkup sets the reply markup.

type SendOptions

type SendOptions struct {
	ReplyMarkup        *tg.InlineKeyboardMarkup
	ParseMode          string
	Caption            string                 // For media methods (sendPhoto, sendDocument, etc.)
	LinkPreviewOptions *tg.LinkPreviewOptions // For sendMessage
}

SendOptions holds optional parameters for sending.

type SendPhotoStep

type SendPhotoStep struct {
	Photo   MediaInput
	Caption string
}

SendPhotoStep sends a photo.

func (*SendPhotoStep) Execute

func (s *SendPhotoStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendPhotoStep) Name

func (s *SendPhotoStep) Name() string

type SendPhotoWithParseModeStep

type SendPhotoWithParseModeStep struct {
	Photo     MediaInput // Required: pass via MediaFromBytes(fixtures.PhotoBytes(), ...)
	Caption   string
	ParseMode tg.ParseMode // Use actual type for compile-time safety
}

SendPhotoWithParseModeStep tests ParseMode in multipart requests. This catches the named-string-type serialization bug in BuildMultipartRequest. Uses tg.ParseMode for compile-time safety. See: https://github.com/prilive-com/galigo/issues/5

func (*SendPhotoWithParseModeStep) Execute

func (*SendPhotoWithParseModeStep) Name

type SendPollSimpleStep

type SendPollSimpleStep struct {
	Question string
	Options  []string
}

SendPollSimpleStep sends a simple poll.

func (*SendPollSimpleStep) Execute

func (s *SendPollSimpleStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendPollSimpleStep) Name

func (s *SendPollSimpleStep) Name() string

type SendQuizStep

type SendQuizStep struct {
	Question        string
	Options         []string
	CorrectOptionID int
}

SendQuizStep sends a quiz poll.

func (*SendQuizStep) Execute

func (s *SendQuizStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendQuizStep) Name

func (s *SendQuizStep) Name() string

type SendStickerStep

type SendStickerStep struct {
	Sticker MediaInput
}

SendStickerStep sends a sticker.

func (*SendStickerStep) Execute

func (s *SendStickerStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendStickerStep) Name

func (s *SendStickerStep) Name() string

type SendVenueStep

type SendVenueStep struct {
	Latitude  float64
	Longitude float64
	Title     string
	Address   string
}

SendVenueStep sends a venue.

func (*SendVenueStep) Execute

func (s *SendVenueStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendVenueStep) Name

func (s *SendVenueStep) Name() string

type SendVideoNoteStep

type SendVideoNoteStep struct {
	VideoNote MediaInput
}

SendVideoNoteStep sends a video note (round video).

func (*SendVideoNoteStep) Execute

func (s *SendVideoNoteStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendVideoNoteStep) Name

func (s *SendVideoNoteStep) Name() string

type SendVideoStep

type SendVideoStep struct {
	Video   MediaInput
	Caption string
}

SendVideoStep sends a video.

func (*SendVideoStep) Execute

func (s *SendVideoStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendVideoStep) Name

func (s *SendVideoStep) Name() string

type SendVoiceStep

type SendVoiceStep struct {
	Voice   MediaInput
	Caption string
}

SendVoiceStep sends a voice message.

func (*SendVoiceStep) Execute

func (s *SendVoiceStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SendVoiceStep) Name

func (s *SendVoiceStep) Name() string

type SenderAdapter

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

SenderAdapter adapts sender.Client to SenderClient interface.

func NewSenderAdapter

func NewSenderAdapter(client *sender.Client) *SenderAdapter

NewSenderAdapter creates a new adapter wrapping a sender.Client.

func (*SenderAdapter) AddStickerToSet

func (a *SenderAdapter) AddStickerToSet(ctx context.Context, userID int64, name string, sticker StickerInput) error

AddStickerToSet adds a sticker to an existing set.

func (*SenderAdapter) AnswerCallbackQuery

func (a *SenderAdapter) AnswerCallbackQuery(ctx context.Context, callbackQueryID string, text string, showAlert bool) error

AnswerCallbackQuery answers a callback query.

func (*SenderAdapter) CopyMessage

func (a *SenderAdapter) CopyMessage(ctx context.Context, chatID, fromChatID int64, messageID int) (*tg.MessageID, error)

CopyMessage copies a message.

func (*SenderAdapter) CopyMessages

func (a *SenderAdapter) CopyMessages(ctx context.Context, chatID, fromChatID int64, messageIDs []int) ([]tg.MessageID, error)

CopyMessages copies multiple messages.

func (*SenderAdapter) CreateNewStickerSet

func (a *SenderAdapter) CreateNewStickerSet(ctx context.Context, userID int64, name, title string, stickers []StickerInput) error

CreateNewStickerSet creates a new sticker set.

func (*SenderAdapter) DeleteChatPhoto

func (a *SenderAdapter) DeleteChatPhoto(ctx context.Context, chatID int64) error

DeleteChatPhoto deletes the chat photo.

func (*SenderAdapter) DeleteMessage

func (a *SenderAdapter) DeleteMessage(ctx context.Context, chatID int64, messageID int) error

DeleteMessage deletes a message.

func (*SenderAdapter) DeleteMessages

func (a *SenderAdapter) DeleteMessages(ctx context.Context, chatID int64, messageIDs []int) error

DeleteMessages deletes multiple messages.

func (*SenderAdapter) DeleteMyCommands

func (a *SenderAdapter) DeleteMyCommands(ctx context.Context) error

DeleteMyCommands removes the bot's command list.

func (*SenderAdapter) DeleteStickerFromSet

func (a *SenderAdapter) DeleteStickerFromSet(ctx context.Context, sticker string) error

DeleteStickerFromSet deletes a sticker from a set.

func (*SenderAdapter) DeleteStickerSet

func (a *SenderAdapter) DeleteStickerSet(ctx context.Context, name string) error

DeleteStickerSet deletes a sticker set.

func (*SenderAdapter) DeleteWebhook

func (a *SenderAdapter) DeleteWebhook(ctx context.Context) error

DeleteWebhook removes the webhook.

func (*SenderAdapter) EditMessageCaption

func (a *SenderAdapter) EditMessageCaption(ctx context.Context, chatID int64, messageID int, caption string) (*tg.Message, error)

EditMessageCaption edits a message's caption.

func (*SenderAdapter) EditMessageChecklist

func (a *SenderAdapter) EditMessageChecklist(ctx context.Context, chatID int64, messageID int, title string, tasks []ChecklistTaskInput) (*tg.Message, error)

EditMessageChecklist edits a checklist message.

func (*SenderAdapter) EditMessageMedia

func (a *SenderAdapter) EditMessageMedia(ctx context.Context, chatID int64, messageID int, media sender.InputMedia) (*tg.Message, error)

EditMessageMedia edits a message's media content.

func (*SenderAdapter) EditMessageReplyMarkup

func (a *SenderAdapter) EditMessageReplyMarkup(ctx context.Context, chatID int64, messageID int, markup *tg.InlineKeyboardMarkup) (*tg.Message, error)

EditMessageReplyMarkup edits a message's reply markup.

func (*SenderAdapter) EditMessageText

func (a *SenderAdapter) EditMessageText(ctx context.Context, chatID int64, messageID int, text string) (*tg.Message, error)

EditMessageText edits a message's text.

func (*SenderAdapter) ForwardMessage

func (a *SenderAdapter) ForwardMessage(ctx context.Context, chatID, fromChatID int64, messageID int) (*tg.Message, error)

ForwardMessage forwards a message.

func (*SenderAdapter) ForwardMessages

func (a *SenderAdapter) ForwardMessages(ctx context.Context, chatID, fromChatID int64, messageIDs []int) ([]tg.MessageID, error)

ForwardMessages forwards multiple messages.

func (*SenderAdapter) GetAvailableGifts

func (a *SenderAdapter) GetAvailableGifts(ctx context.Context) (*tg.Gifts, error)

GetAvailableGifts returns available gifts.

func (*SenderAdapter) GetChat

func (a *SenderAdapter) GetChat(ctx context.Context, chatID int64) (*tg.ChatFullInfo, error)

GetChat gets full chat info.

func (*SenderAdapter) GetChatAdministrators

func (a *SenderAdapter) GetChatAdministrators(ctx context.Context, chatID int64) ([]tg.ChatMember, error)

GetChatAdministrators returns chat admins.

func (*SenderAdapter) GetChatMember

func (a *SenderAdapter) GetChatMember(ctx context.Context, chatID int64, userID int64) (tg.ChatMember, error)

GetChatMember returns info about a member.

func (*SenderAdapter) GetChatMemberCount

func (a *SenderAdapter) GetChatMemberCount(ctx context.Context, chatID int64) (int, error)

GetChatMemberCount returns the member count.

func (*SenderAdapter) GetFile

func (a *SenderAdapter) GetFile(ctx context.Context, fileID string) (*tg.File, error)

GetFile gets file info for download.

func (*SenderAdapter) GetForumTopicIconStickers

func (a *SenderAdapter) GetForumTopicIconStickers(ctx context.Context) ([]*tg.Sticker, error)

GetForumTopicIconStickers gets available forum topic icon stickers.

func (*SenderAdapter) GetMe

func (a *SenderAdapter) GetMe(ctx context.Context) (*tg.User, error)

GetMe returns basic information about the bot.

func (*SenderAdapter) GetMyCommands

func (a *SenderAdapter) GetMyCommands(ctx context.Context) ([]tg.BotCommand, error)

GetMyCommands returns the bot's command list.

func (*SenderAdapter) GetMyDefaultAdministratorRights

func (a *SenderAdapter) GetMyDefaultAdministratorRights(ctx context.Context, forChannels bool) (*tg.ChatAdministratorRights, error)

GetMyDefaultAdministratorRights returns the bot's default admin rights.

func (*SenderAdapter) GetMyDescription

func (a *SenderAdapter) GetMyDescription(ctx context.Context) (*tg.BotDescription, error)

GetMyDescription returns the bot's description.

func (*SenderAdapter) GetMyName

func (a *SenderAdapter) GetMyName(ctx context.Context) (*tg.BotName, error)

GetMyName returns the bot's name.

func (*SenderAdapter) GetMyShortDescription

func (a *SenderAdapter) GetMyShortDescription(ctx context.Context) (*tg.BotShortDescription, error)

GetMyShortDescription returns the bot's short description.

func (*SenderAdapter) GetMyStarBalance

func (a *SenderAdapter) GetMyStarBalance(ctx context.Context) (*tg.StarAmount, error)

GetMyStarBalance returns the bot's Star balance.

func (*SenderAdapter) GetStarTransactions

func (a *SenderAdapter) GetStarTransactions(ctx context.Context, limit int) (*tg.StarTransactions, error)

GetStarTransactions returns the bot's Star transactions.

func (*SenderAdapter) GetStickerSet

func (a *SenderAdapter) GetStickerSet(ctx context.Context, name string) (*tg.StickerSet, error)

GetStickerSet returns a sticker set by name.

func (*SenderAdapter) GetUpdates

func (a *SenderAdapter) GetUpdates(ctx context.Context, offset int64, limit int, timeout int) ([]tg.Update, error)

GetUpdates calls the getUpdates API directly.

func (*SenderAdapter) GetUserChatBoosts

func (a *SenderAdapter) GetUserChatBoosts(ctx context.Context, chatID, userID int64) (*tg.UserChatBoosts, error)

GetUserChatBoosts returns a user's boosts in the chat.

func (*SenderAdapter) GetUserProfileAudios

func (a *SenderAdapter) GetUserProfileAudios(ctx context.Context, userID int64) (*tg.UserProfileAudios, error)

GetUserProfileAudios returns a user's profile audios. Added in Bot API 9.4.

func (*SenderAdapter) GetUserProfilePhotos

func (a *SenderAdapter) GetUserProfilePhotos(ctx context.Context, userID int64) (*tg.UserProfilePhotos, error)

GetUserProfilePhotos returns a user's profile pictures.

func (*SenderAdapter) GetWebhookInfo

func (a *SenderAdapter) GetWebhookInfo(ctx context.Context) (*WebhookInfo, error)

GetWebhookInfo retrieves webhook configuration.

func (*SenderAdapter) PinChatMessage

func (a *SenderAdapter) PinChatMessage(ctx context.Context, chatID int64, messageID int, silent bool) error

PinChatMessage pins a message.

func (*SenderAdapter) ReplaceStickerInSet

func (a *SenderAdapter) ReplaceStickerInSet(ctx context.Context, userID int64, name, oldSticker string, sticker StickerInput) error

ReplaceStickerInSet replaces a sticker in a set.

func (*SenderAdapter) SendAnimation

func (a *SenderAdapter) SendAnimation(ctx context.Context, chatID int64, animation MediaInput, caption string) (*tg.Message, error)

SendAnimation sends an animation (GIF).

func (*SenderAdapter) SendAudio

func (a *SenderAdapter) SendAudio(ctx context.Context, chatID int64, audio MediaInput, caption string) (*tg.Message, error)

SendAudio sends an audio file.

func (*SenderAdapter) SendChatAction

func (a *SenderAdapter) SendChatAction(ctx context.Context, chatID int64, action string) error

SendChatAction sends a chat action.

func (*SenderAdapter) SendChecklist

func (a *SenderAdapter) SendChecklist(ctx context.Context, chatID int64, title string, tasks []string) (*tg.Message, error)

SendChecklist sends a checklist message.

func (*SenderAdapter) SendContact

func (a *SenderAdapter) SendContact(ctx context.Context, chatID int64, phone, firstName, lastName string) (*tg.Message, error)

SendContact sends a phone contact.

func (*SenderAdapter) SendDice

func (a *SenderAdapter) SendDice(ctx context.Context, chatID int64, emoji string) (*tg.Message, error)

SendDice sends an animated dice emoji.

func (*SenderAdapter) SendDocument

func (a *SenderAdapter) SendDocument(ctx context.Context, chatID int64, document MediaInput, caption string) (*tg.Message, error)

SendDocument sends a document.

func (*SenderAdapter) SendInvoice

func (a *SenderAdapter) SendInvoice(ctx context.Context, chatID int64, title, description, payload, currency string, prices []tg.LabeledPrice) (*tg.Message, error)

SendInvoice sends an invoice.

func (*SenderAdapter) SendLocation

func (a *SenderAdapter) SendLocation(ctx context.Context, chatID int64, lat, lon float64) (*tg.Message, error)

SendLocation sends a GPS location.

func (*SenderAdapter) SendMediaGroup

func (a *SenderAdapter) SendMediaGroup(ctx context.Context, chatID int64, media []MediaInput) ([]*tg.Message, error)

SendMediaGroup sends a media group (album).

func (*SenderAdapter) SendMessage

func (a *SenderAdapter) SendMessage(ctx context.Context, chatID int64, text string, opts ...SendOption) (*tg.Message, error)

SendMessage sends a text message.

func (*SenderAdapter) SendPhoto

func (a *SenderAdapter) SendPhoto(ctx context.Context, chatID int64, photo MediaInput, opts ...SendOption) (*tg.Message, error)

SendPhoto sends a photo with optional caption and parse mode.

func (*SenderAdapter) SendPollSimple

func (a *SenderAdapter) SendPollSimple(ctx context.Context, chatID int64, question string, options []string) (*tg.Message, error)

SendPollSimple sends a simple poll.

func (*SenderAdapter) SendQuiz

func (a *SenderAdapter) SendQuiz(ctx context.Context, chatID int64, question string, options []string, correctOptionID int) (*tg.Message, error)

SendQuiz sends a quiz poll.

func (*SenderAdapter) SendSticker

func (a *SenderAdapter) SendSticker(ctx context.Context, chatID int64, sticker MediaInput) (*tg.Message, error)

SendSticker sends a sticker.

func (*SenderAdapter) SendVenue

func (a *SenderAdapter) SendVenue(ctx context.Context, chatID int64, lat, lon float64, title, address string) (*tg.Message, error)

SendVenue sends a venue.

func (*SenderAdapter) SendVideo

func (a *SenderAdapter) SendVideo(ctx context.Context, chatID int64, video MediaInput, caption string) (*tg.Message, error)

SendVideo sends a video.

func (*SenderAdapter) SendVideoNote

func (a *SenderAdapter) SendVideoNote(ctx context.Context, chatID int64, videoNote MediaInput) (*tg.Message, error)

SendVideoNote sends a video note (round video).

func (*SenderAdapter) SendVoice

func (a *SenderAdapter) SendVoice(ctx context.Context, chatID int64, voice MediaInput, caption string) (*tg.Message, error)

SendVoice sends a voice message.

func (*SenderAdapter) SetChatDescription

func (a *SenderAdapter) SetChatDescription(ctx context.Context, chatID int64, description string) error

SetChatDescription sets the chat description.

func (*SenderAdapter) SetChatPermissions

func (a *SenderAdapter) SetChatPermissions(ctx context.Context, chatID int64, perms tg.ChatPermissions) error

SetChatPermissions sets the default chat permissions.

func (*SenderAdapter) SetChatPhoto

func (a *SenderAdapter) SetChatPhoto(ctx context.Context, chatID int64, photo sender.InputFile) error

SetChatPhoto sets the chat photo.

func (*SenderAdapter) SetChatTitle

func (a *SenderAdapter) SetChatTitle(ctx context.Context, chatID int64, title string) error

SetChatTitle sets the chat title.

func (*SenderAdapter) SetMessageReaction

func (a *SenderAdapter) SetMessageReaction(ctx context.Context, chatID int64, messageID int, emoji string, isBig bool) error

SetMessageReaction sets a reaction on a message.

func (*SenderAdapter) SetMyCommands

func (a *SenderAdapter) SetMyCommands(ctx context.Context, commands []tg.BotCommand) error

SetMyCommands sets the bot's command list.

func (*SenderAdapter) SetMyDefaultAdministratorRights

func (a *SenderAdapter) SetMyDefaultAdministratorRights(ctx context.Context, rights *tg.ChatAdministratorRights, forChannels bool) error

SetMyDefaultAdministratorRights sets the bot's default admin rights.

func (*SenderAdapter) SetMyDescription

func (a *SenderAdapter) SetMyDescription(ctx context.Context, description string) error

SetMyDescription sets the bot's description.

func (*SenderAdapter) SetMyName

func (a *SenderAdapter) SetMyName(ctx context.Context, name string) error

SetMyName sets the bot's name.

func (*SenderAdapter) SetMyShortDescription

func (a *SenderAdapter) SetMyShortDescription(ctx context.Context, shortDescription string) error

SetMyShortDescription sets the bot's short description.

func (*SenderAdapter) SetStickerEmojiList

func (a *SenderAdapter) SetStickerEmojiList(ctx context.Context, sticker string, emojiList []string) error

SetStickerEmojiList sets the emoji list for a sticker.

func (*SenderAdapter) SetStickerPositionInSet

func (a *SenderAdapter) SetStickerPositionInSet(ctx context.Context, sticker string, position int) error

SetStickerPositionInSet moves a sticker in a set.

func (*SenderAdapter) SetStickerSetTitle

func (a *SenderAdapter) SetStickerSetTitle(ctx context.Context, name, title string) error

SetStickerSetTitle sets the title of a sticker set.

func (*SenderAdapter) SetWebhook

func (a *SenderAdapter) SetWebhook(ctx context.Context, webhookURL string) error

SetWebhook sets a webhook URL.

func (*SenderAdapter) StopPoll

func (a *SenderAdapter) StopPoll(ctx context.Context, chatID int64, messageID int) (*tg.Poll, error)

StopPoll stops a poll.

func (*SenderAdapter) UnpinAllChatMessages

func (a *SenderAdapter) UnpinAllChatMessages(ctx context.Context, chatID int64) error

UnpinAllChatMessages unpins all messages.

func (*SenderAdapter) UnpinChatMessage

func (a *SenderAdapter) UnpinChatMessage(ctx context.Context, chatID int64, messageID int) error

UnpinChatMessage unpins a message.

func (*SenderAdapter) UploadStickerFile

func (a *SenderAdapter) UploadStickerFile(ctx context.Context, userID int64, sticker MediaInput, stickerFormat string) (*tg.File, error)

UploadStickerFile uploads a sticker file.

func (*SenderAdapter) WithHTTPClient

func (a *SenderAdapter) WithHTTPClient(client *http.Client) *SenderAdapter

WithHTTPClient sets the HTTP client for webhook/polling operations.

func (*SenderAdapter) WithToken

func (a *SenderAdapter) WithToken(token tg.SecretToken) *SenderAdapter

WithToken sets the token for webhook/polling operations.

type SenderClient

type SenderClient interface {
	GetMe(ctx context.Context) (*tg.User, error)
	SendMessage(ctx context.Context, chatID int64, text string, opts ...SendOption) (*tg.Message, error)
	EditMessageText(ctx context.Context, chatID int64, messageID int, text string) (*tg.Message, error)
	DeleteMessage(ctx context.Context, chatID int64, messageID int) error
	ForwardMessage(ctx context.Context, chatID, fromChatID int64, messageID int) (*tg.Message, error)
	CopyMessage(ctx context.Context, chatID, fromChatID int64, messageID int) (*tg.MessageID, error)
	SendChatAction(ctx context.Context, chatID int64, action string) error

	// Media methods (Phase B)
	SendPhoto(ctx context.Context, chatID int64, photo MediaInput, opts ...SendOption) (*tg.Message, error)
	SendDocument(ctx context.Context, chatID int64, document MediaInput, caption string) (*tg.Message, error)
	SendAnimation(ctx context.Context, chatID int64, animation MediaInput, caption string) (*tg.Message, error)
	SendVideo(ctx context.Context, chatID int64, video MediaInput, caption string) (*tg.Message, error)
	SendAudio(ctx context.Context, chatID int64, audio MediaInput, caption string) (*tg.Message, error)
	SendVoice(ctx context.Context, chatID int64, voice MediaInput, caption string) (*tg.Message, error)
	SendSticker(ctx context.Context, chatID int64, sticker MediaInput) (*tg.Message, error)
	SendVideoNote(ctx context.Context, chatID int64, videoNote MediaInput) (*tg.Message, error)
	SendMediaGroup(ctx context.Context, chatID int64, media []MediaInput) ([]*tg.Message, error)
	GetFile(ctx context.Context, fileID string) (*tg.File, error)
	EditMessageCaption(ctx context.Context, chatID int64, messageID int, caption string) (*tg.Message, error)
	EditMessageReplyMarkup(ctx context.Context, chatID int64, messageID int, markup *tg.InlineKeyboardMarkup) (*tg.Message, error)
	EditMessageMedia(ctx context.Context, chatID int64, messageID int, media sender.InputMedia) (*tg.Message, error)

	// Callback query methods (interactive scenarios)
	AnswerCallbackQuery(ctx context.Context, callbackQueryID string, text string, showAlert bool) error

	// Tier 2: Chat info
	GetChat(ctx context.Context, chatID int64) (*tg.ChatFullInfo, error)
	GetChatAdministrators(ctx context.Context, chatID int64) ([]tg.ChatMember, error)
	GetChatMemberCount(ctx context.Context, chatID int64) (int, error)
	GetChatMember(ctx context.Context, chatID int64, userID int64) (tg.ChatMember, error)

	// Tier 2: Chat settings
	SetChatTitle(ctx context.Context, chatID int64, title string) error
	SetChatDescription(ctx context.Context, chatID int64, description string) error

	// Tier 2: Pin messages
	PinChatMessage(ctx context.Context, chatID int64, messageID int, silent bool) error
	UnpinChatMessage(ctx context.Context, chatID int64, messageID int) error
	UnpinAllChatMessages(ctx context.Context, chatID int64) error

	// Tier 2: Polls
	SendPollSimple(ctx context.Context, chatID int64, question string, options []string) (*tg.Message, error)
	SendQuiz(ctx context.Context, chatID int64, question string, options []string, correctOptionID int) (*tg.Message, error)
	StopPoll(ctx context.Context, chatID int64, messageID int) (*tg.Poll, error)

	// Tier 2: Forum
	GetForumTopicIconStickers(ctx context.Context) ([]*tg.Sticker, error)

	// Extended: Stickers
	GetStickerSet(ctx context.Context, name string) (*tg.StickerSet, error)
	UploadStickerFile(ctx context.Context, userID int64, sticker MediaInput, stickerFormat string) (*tg.File, error)
	CreateNewStickerSet(ctx context.Context, userID int64, name, title string, stickers []StickerInput) error
	AddStickerToSet(ctx context.Context, userID int64, name string, sticker StickerInput) error
	SetStickerPositionInSet(ctx context.Context, sticker string, position int) error
	DeleteStickerFromSet(ctx context.Context, sticker string) error
	SetStickerSetTitle(ctx context.Context, name, title string) error
	DeleteStickerSet(ctx context.Context, name string) error
	SetStickerEmojiList(ctx context.Context, sticker string, emojiList []string) error
	ReplaceStickerInSet(ctx context.Context, userID int64, name, oldSticker string, sticker StickerInput) error

	// Extended: Stars & Payments
	GetMyStarBalance(ctx context.Context) (*tg.StarAmount, error)
	GetStarTransactions(ctx context.Context, limit int) (*tg.StarTransactions, error)
	SendInvoice(ctx context.Context, chatID int64, title, description, payload, currency string, prices []tg.LabeledPrice) (*tg.Message, error)

	// Extended: Gifts
	GetAvailableGifts(ctx context.Context) (*tg.Gifts, error)

	// Extended: Checklists
	SendChecklist(ctx context.Context, chatID int64, title string, tasks []string) (*tg.Message, error)
	EditMessageChecklist(ctx context.Context, chatID int64, messageID int, title string, tasks []ChecklistTaskInput) (*tg.Message, error)

	// Geo & Contact
	SendLocation(ctx context.Context, chatID int64, lat, lon float64) (*tg.Message, error)
	SendVenue(ctx context.Context, chatID int64, lat, lon float64, title, address string) (*tg.Message, error)
	SendContact(ctx context.Context, chatID int64, phone, firstName, lastName string) (*tg.Message, error)
	SendDice(ctx context.Context, chatID int64, emoji string) (*tg.Message, error)

	// Reactions & User info
	SetMessageReaction(ctx context.Context, chatID int64, messageID int, emoji string, isBig bool) error
	GetUserProfilePhotos(ctx context.Context, userID int64) (*tg.UserProfilePhotos, error)
	GetUserProfileAudios(ctx context.Context, userID int64) (*tg.UserProfileAudios, error) // 9.4
	GetUserChatBoosts(ctx context.Context, chatID, userID int64) (*tg.UserChatBoosts, error)

	// Bulk operations
	ForwardMessages(ctx context.Context, chatID, fromChatID int64, messageIDs []int) ([]tg.MessageID, error)
	CopyMessages(ctx context.Context, chatID, fromChatID int64, messageIDs []int) ([]tg.MessageID, error)
	DeleteMessages(ctx context.Context, chatID int64, messageIDs []int) error

	// Chat settings
	SetChatPhoto(ctx context.Context, chatID int64, photo sender.InputFile) error
	DeleteChatPhoto(ctx context.Context, chatID int64) error
	SetChatPermissions(ctx context.Context, chatID int64, perms tg.ChatPermissions) error

	// Bot Identity
	SetMyCommands(ctx context.Context, commands []tg.BotCommand) error
	GetMyCommands(ctx context.Context) ([]tg.BotCommand, error)
	DeleteMyCommands(ctx context.Context) error
	SetMyName(ctx context.Context, name string) error
	GetMyName(ctx context.Context) (*tg.BotName, error)
	SetMyDescription(ctx context.Context, description string) error
	GetMyDescription(ctx context.Context) (*tg.BotDescription, error)
	SetMyShortDescription(ctx context.Context, shortDescription string) error
	GetMyShortDescription(ctx context.Context) (*tg.BotShortDescription, error)
	SetMyDefaultAdministratorRights(ctx context.Context, rights *tg.ChatAdministratorRights, forChannels bool) error
	GetMyDefaultAdministratorRights(ctx context.Context, forChannels bool) (*tg.ChatAdministratorRights, error)

	// Webhook management methods
	SetWebhook(ctx context.Context, url string) error
	DeleteWebhook(ctx context.Context) error
	GetWebhookInfo(ctx context.Context) (*WebhookInfo, error)

	// Polling
	GetUpdates(ctx context.Context, offset int64, limit int, timeout int) ([]tg.Update, error)
}

SenderClient is the interface for sending messages (allows mocking).

type SetChatDescriptionStep

type SetChatDescriptionStep struct {
	Description string
}

SetChatDescriptionStep sets the chat description.

func (*SetChatDescriptionStep) Execute

func (s *SetChatDescriptionStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetChatDescriptionStep) Name

func (s *SetChatDescriptionStep) Name() string

type SetChatPermissionsStep

type SetChatPermissionsStep struct{}

SetChatPermissionsStep temporarily restricts to text-only using existing helpers.

func (*SetChatPermissionsStep) Execute

func (s *SetChatPermissionsStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetChatPermissionsStep) Name

func (s *SetChatPermissionsStep) Name() string

type SetChatPhotoStep

type SetChatPhotoStep struct {
	PhotoBytes []byte // If nil, uses ChatPhotoPNG
}

SetChatPhotoStep sets the chat photo using the sticker fixture (512x512 PNG). Chat photos require at least 160x160 pixels.

func (*SetChatPhotoStep) Execute

func (s *SetChatPhotoStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetChatPhotoStep) Name

func (s *SetChatPhotoStep) Name() string

type SetChatTitleStep

type SetChatTitleStep struct {
	Title string
}

SetChatTitleStep sets the chat title.

func (*SetChatTitleStep) Execute

func (s *SetChatTitleStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetChatTitleStep) Name

func (s *SetChatTitleStep) Name() string

type SetMessageReactionStep

type SetMessageReactionStep struct {
	Emoji string
	IsBig bool
}

SetMessageReactionStep sets an emoji reaction on the last message.

func (*SetMessageReactionStep) Execute

func (s *SetMessageReactionStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetMessageReactionStep) Name

func (s *SetMessageReactionStep) Name() string

type SetMyCommandsStep

type SetMyCommandsStep struct {
	Commands []tg.BotCommand
}

SetMyCommandsStep sets the bot's command list.

func (*SetMyCommandsStep) Execute

func (s *SetMyCommandsStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetMyCommandsStep) Name

func (s *SetMyCommandsStep) Name() string

type SetMyDefaultAdministratorRightsStep

type SetMyDefaultAdministratorRightsStep struct {
	Rights      *tg.ChatAdministratorRights
	ForChannels bool
}

SetMyDefaultAdministratorRightsStep sets the bot's default admin rights.

func (*SetMyDefaultAdministratorRightsStep) Execute

func (*SetMyDefaultAdministratorRightsStep) Name

type SetMyDescriptionStep

type SetMyDescriptionStep struct {
	Description string
}

SetMyDescriptionStep sets the bot's description.

func (*SetMyDescriptionStep) Execute

func (s *SetMyDescriptionStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetMyDescriptionStep) Name

func (s *SetMyDescriptionStep) Name() string

type SetMyNameStep

type SetMyNameStep struct {
	BotName string
}

SetMyNameStep sets the bot's name.

func (*SetMyNameStep) Execute

func (s *SetMyNameStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetMyNameStep) Name

func (s *SetMyNameStep) Name() string

type SetMyShortDescriptionStep

type SetMyShortDescriptionStep struct {
	ShortDescription string
}

SetMyShortDescriptionStep sets the bot's short description.

func (*SetMyShortDescriptionStep) Execute

func (*SetMyShortDescriptionStep) Name

type SetStickerEmojiListStep

type SetStickerEmojiListStep struct {
	EmojiList []string
}

SetStickerEmojiListStep changes emoji for the captured sticker.

func (*SetStickerEmojiListStep) Execute

func (*SetStickerEmojiListStep) Name

func (s *SetStickerEmojiListStep) Name() string

type SetStickerPositionStep

type SetStickerPositionStep struct {
	Position int
}

SetStickerPositionStep moves a sticker in the set.

func (*SetStickerPositionStep) Execute

func (s *SetStickerPositionStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetStickerPositionStep) Name

func (s *SetStickerPositionStep) Name() string

type SetStickerSetTitleStep

type SetStickerSetTitleStep struct {
	Title string
}

SetStickerSetTitleStep changes the title of the tracked sticker set.

func (*SetStickerSetTitleStep) Execute

func (s *SetStickerSetTitleStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetStickerSetTitleStep) Name

func (s *SetStickerSetTitleStep) Name() string

type SetWebhookStep

type SetWebhookStep struct {
	URL string
}

SetWebhookStep sets a webhook URL.

func (*SetWebhookStep) Execute

func (s *SetWebhookStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*SetWebhookStep) Name

func (s *SetWebhookStep) Name() string

type SkipError

type SkipError struct {
	Reason string
}

SkipError indicates a scenario was skipped due to missing prerequisites.

func (SkipError) Error

func (e SkipError) Error() string

type Step

type Step interface {
	Name() string
	Execute(ctx context.Context, rt *Runtime) (*StepResult, error)
}

Step represents a single test step.

type StepResult

type StepResult struct {
	StepName   string        `json:"step_name"`
	Method     string        `json:"method,omitempty"`
	Duration   time.Duration `json:"duration"`
	Success    bool          `json:"success"`
	Error      string        `json:"error,omitempty"`
	MessageIDs []int         `json:"message_ids,omitempty"`
	FileIDs    []string      `json:"file_ids,omitempty"`
	Evidence   any           `json:"evidence,omitempty"`
}

StepResult captures evidence from step execution.

type StickerInput

type StickerInput struct {
	Sticker   MediaInput
	Format    string   // "static", "animated", "video"
	EmojiList []string // e.g., ["😀"]
}

StickerInput represents a sticker for creating/adding to sticker sets.

type StopPollStep

type StopPollStep struct{}

StopPollStep stops the last poll message.

func (*StopPollStep) Execute

func (s *StopPollStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*StopPollStep) Name

func (s *StopPollStep) Name() string

type UnpinAllChatMessagesStep

type UnpinAllChatMessagesStep struct{}

UnpinAllChatMessagesStep unpins all messages.

func (*UnpinAllChatMessagesStep) Execute

func (*UnpinAllChatMessagesStep) Name

func (s *UnpinAllChatMessagesStep) Name() string

type UnpinChatMessageStep

type UnpinChatMessageStep struct{}

UnpinChatMessageStep unpins the last sent message.

func (*UnpinChatMessageStep) Execute

func (s *UnpinChatMessageStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*UnpinChatMessageStep) Name

func (s *UnpinChatMessageStep) Name() string

type VerifyChatInfo94Step

type VerifyChatInfo94Step struct{}

VerifyChatInfo94Step verifies 9.4 ChatFullInfo fields are deserializable.

func (*VerifyChatInfo94Step) Execute

func (s *VerifyChatInfo94Step) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*VerifyChatInfo94Step) Name

func (s *VerifyChatInfo94Step) Name() string

type VerifyVideoQualitiesStep

type VerifyVideoQualitiesStep struct{}

VerifyVideoQualitiesStep verifies the 9.4 Video.Qualities field deserializes correctly.

func (*VerifyVideoQualitiesStep) Execute

func (*VerifyVideoQualitiesStep) Name

func (s *VerifyVideoQualitiesStep) Name() string

type VerifyWebhookURLStep

type VerifyWebhookURLStep struct {
	ExpectedURL string
}

VerifyWebhookURLStep checks that the current webhook URL matches the expected value.

func (*VerifyWebhookURLStep) Execute

func (s *VerifyWebhookURLStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*VerifyWebhookURLStep) Name

func (s *VerifyWebhookURLStep) Name() string

type WaitForCallbackStep

type WaitForCallbackStep struct {
	Timeout time.Duration // Max wait time; defaults to 60s
}

WaitForCallbackStep waits for a callback query on rt.CallbackChan.

func (*WaitForCallbackStep) Execute

func (s *WaitForCallbackStep) Execute(ctx context.Context, rt *Runtime) (*StepResult, error)

func (*WaitForCallbackStep) Name

func (s *WaitForCallbackStep) Name() string

type WebhookInfo

type WebhookInfo struct {
	URL                string
	PendingUpdateCount int
	HasCustomCert      bool
}

WebhookInfo contains information about the current webhook configuration.

Jump to

Keyboard shortcuts

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