From 8752cc8c7654aff743c8249249041b322b267b6a Mon Sep 17 00:00:00 2001 From: Trent Mellor <50112750+tmellon@users.noreply.github.com> Date: Fri, 10 Jan 2025 03:56:20 -0600 Subject: [PATCH] Update twitter_actions.py Fix error where last_tweet_time is referenced before declaration when "last_tweet_time" is in agent.state --- src/actions/twitter_actions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/actions/twitter_actions.py b/src/actions/twitter_actions.py index 390ff15f..47dea4f9 100644 --- a/src/actions/twitter_actions.py +++ b/src/actions/twitter_actions.py @@ -10,6 +10,8 @@ def post_tweet(agent, **kwargs): if ("last_tweet_time" not in agent.state): last_tweet_time = 0 + else: + last_tweet_time = agent.state["last_tweet_time"] if current_time - last_tweet_time >= agent.tweet_interval: agent.logger.info("\nšŸ“ GENERATING NEW TWEET") @@ -91,4 +93,4 @@ def like_tweet(agent, **kwargs): return True else: agent.logger.info("\nšŸ‘€ No tweets found to like...") - return False \ No newline at end of file + return False