@@ -145,9 +145,9 @@ async def send_message(contact, message):
145145async def auto_respond_to_unread ():
146146 """Click unread tab and respond to messages"""
147147 print ('\n Auto-responding to unread messages...' )
148-
148+
149149 llm = ChatGoogle (model = 'gemini-2.0-flash-exp' , temperature = 0.3 , api_key = GOOGLE_API_KEY )
150-
150+
151151 task = """
152152 1. Go to https://web.whatsapp.com
153153 2. Wait for page to load
@@ -159,13 +159,13 @@ async def auto_respond_to_unread():
159159 - Move to next unread chat
160160 5. Report how many messages were responded to
161161 """
162-
162+
163163 browser = BrowserSession (
164164 headless = not args .debug ,
165165 user_data_dir = str (USER_DATA_DIR ),
166166 storage_state = str (STORAGE_STATE_FILE ) if STORAGE_STATE_FILE .exists () else None ,
167167 )
168-
168+
169169 agent = Agent (task = task , llm = llm , browser_session = browser )
170170 result = await agent .run ()
171171 print ('✅ Auto-response complete' )
@@ -185,16 +185,16 @@ async def main():
185185 if args .auto :
186186 print ('AUTO MODE - Responding to unread messages every ~30 minutes' )
187187 print ('Press Ctrl+C to stop.\n ' )
188-
188+
189189 while True :
190190 try :
191191 await auto_respond_to_unread ()
192-
192+
193193 # Wait 30 minutes +/- 5 minutes randomly
194194 wait_minutes = 30 + random .randint (- 5 , 5 )
195195 print (f'\n ⏰ Next check in { wait_minutes } minutes...' )
196196 await asyncio .sleep (wait_minutes * 60 )
197-
197+
198198 except KeyboardInterrupt :
199199 print ('\n \n Auto mode stopped by user' )
200200 break
0 commit comments