twitter_manager

package
v0.0.0-...-a59c08c Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// TwitterConversations represents formatted conversation threads
	TwitterConversations state.StateDataKey = "twitter_conversations"
)

StateDataKey constants for different types of Twitter data

Variables

This section is empty.

Functions

func WithTwitterClient

func WithTwitterClient(client *twitter.Client) options.Option[TwitterManager]

func WithTwitterUsername

func WithTwitterUsername(username string) options.Option[TwitterManager]

Types

type ParsedTweet

type ParsedTweet struct {
	TweetID             string    // Unique identifier for the tweet
	UserID              string    // ID of the tweet author
	UserName            string    // Username of the tweet author
	TweetText           string    // Content of the tweet
	InReplyToTweetID    string    // ID of the tweet this is replying to
	TweetConversationID string    // ID of the root conversation
	CreatedAt           time.Time // When the tweet was created
}

ParsedTweet represents a processed Twitter message with extracted metadata

type TwitterActions

type TwitterActions struct {
	ShouldTweet bool   // Whether to send a tweet response
	ShouldLike  bool   // Whether to like the tweet
	Reasoning   string // Explanation for the chosen actions
}

TwitterActions represents the possible actions an agent can take on Twitter

type TwitterManager

type TwitterManager struct {
	*manager.BaseManager
	options.RequiredFields
	// contains filtered or unexported fields
}

TwitterManager handles Twitter-specific functionality and conversation management

func NewTwitterManager

func NewTwitterManager(
	baseOpts []options.Option[manager.BaseManager],
	twitterOpts ...options.Option[TwitterManager],
) (*TwitterManager, error)

NewTwitterManager creates a new instance of TwitterManager with the provided options. Initializes the base manager and Twitter-specific configurations.

func (*TwitterManager) Context

func (tm *TwitterManager) Context(currentState *state.State) ([]state.StateData, error)

Context formats Twitter conversation data for template rendering. It performs: 1. Decoding tweet metadata from the current message 2. Processing and formatting the conversation thread 3. Returning formatted conversation data for template use

func (*TwitterManager) GetDependencies

func (tm *TwitterManager) GetDependencies() []manager.ManagerID

GetDependencies returns the manager IDs that TwitterManager depends on. Dependencies include: - InsightManagerID: For accessing conversation and user insights - PersonalityManagerID: For maintaining consistent personality in responses

func (*TwitterManager) GetID

func (tm *TwitterManager) GetID() manager.ManagerID

GetID returns the manager's unique identifier

func (*TwitterManager) PostProcess

func (tm *TwitterManager) PostProcess(state *state.State) error

PostProcess performs Twitter-specific actions based on the agent's response. It handles: 1. Verifying the platform is Twitter 2. Decoding tweet metadata 3. Determining appropriate actions (tweet, like, etc.) 4. Executing the decided actions

func (*TwitterManager) Process

func (tm *TwitterManager) Process(state *state.State) error

Process processes incoming tweets and builds conversation context. It performs the following steps: 1. Verifies the message is from Twitter 2. Decodes tweet metadata from the message 3. Reconstructs and stores the conversation thread

func (*TwitterManager) StartBackgroundProcesses

func (tm *TwitterManager) StartBackgroundProcesses()

StartBackgroundProcesses initializes any background tasks. Note: Currently unimplemented as Twitter interactions are handled reactively

func (*TwitterManager) StopBackgroundProcesses

func (tm *TwitterManager) StopBackgroundProcesses()

StopBackgroundProcesses cleanly shuts down any background tasks. Note: Currently unimplemented as no background processes exist

func (*TwitterManager) Store

func (tm *TwitterManager) Store(fragment *db.Fragment) error

Store persists a message fragment to storage

func (*TwitterManager) ValidateRequiredFields

func (t *TwitterManager) ValidateRequiredFields() error

Jump to

Keyboard shortcuts

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