commit 5c5af6eb317137de8300b145b4e405e11b55244d parent e6fcd0fe8b942c9211a30b979f03d559d721bc61 Author: Amit Dutta <amitdutta4255@gmail.com> Date: Fri, 26 Sep 2025 17:33:42 +0530 Add files via upload Diffstat:
49 files changed, 118 insertions(+), 121 deletions(-)
diff --git a/Main.py b/Main.py @@ -19,14 +19,13 @@ if not os.path.exists(log_file) or os.path.getsize(log_file) == 0: with open(log_file, "w", encoding='utf-8') as f: f.write("[]") -def log_message(sender_id, message_content, message_id): +def log_message(sender_id, message_content): """ Logs a new message to a JSON file. - Each message is stored with a timestamp, sender ID, content, and a unique message ID. + Each message is stored with a timestamp, sender ID, and content. """ timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") message_entry = { - "id": message_id, "timestamp": timestamp, "sender": sender_id, "content": message_content @@ -43,34 +42,7 @@ def log_message(sender_id, message_content, message_id): log_data.append(message_entry) with open(log_file, "w", encoding='utf-8') as f: json.dump(log_data, f, indent=4) - print(f"Logged message from {sender_id} with ID {message_id}") - -def log_edit_message(message_id, new_content): - """ - Updates an existing message entry in the log file. - """ - try: - with open(log_file, "r", encoding='utf-8') as f: - log_data = json.load(f) - except (FileNotFoundError, json.JSONDecodeError): - return - - updated_message = None - for entry in log_data: - if entry["id"] == message_id: - entry["content"] = f"(EDITED) {new_content}" - entry["timestamp"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S") - updated_message = entry - break - - if updated_message: - with open(log_file, "w", encoding='utf-8') as f: - json.dump(log_data, f, indent=4) - print(f"Updated message with ID {message_id}") - else: - print(f"Message with ID {message_id} not found, logging a new entry.") - log_message("Edited Message", new_content, message_id) - + print(f"Logged message from {sender_id}") @app.route("/health", methods=["GET"]) def health_check(): @@ -117,36 +89,16 @@ def save_message(): data = request.json sender = data.get("sender") query = data.get("query") - message_id = data.get("message_id") - if not sender or not query or not message_id: - return jsonify({"error": "Missing sender, query, or message_id"}), 400 + if not sender or not query: + return jsonify({"error": "Missing sender or query"}), 400 - log_message(sender, query, message_id) + log_message(sender, query) return jsonify({"status": "success", "message": "Message logged successfully"}), 200 except Exception as e: return jsonify({"error": str(e)}), 500 -@app.route("/edit_message", methods=["POST"]) -def edit_message_route(): - """ - Endpoint to receive edited messages and update the log. - """ - try: - data = request.json - message_id = data.get("message_id") - new_content = data.get("new_content") - - if not message_id or not new_content: - return jsonify({"error": "Missing message_id or new_content"}), 400 - - log_edit_message(message_id, new_content) - return jsonify({"status": "success", "message": "Message updated successfully"}), 200 - - except Exception as e: - return jsonify({"error": str(e)}), 500 - # Run the Flask app on a local server if __name__ == "__main__": app.run(host='0.0.0.0', port=5000) diff --git a/Requirements.txt b/Requirements.txt @@ -16,4 +16,3 @@ pygame edge-tts PyQt5 webdriver-manager -requests diff --git a/ai.py b/ai.py @@ -7,54 +7,26 @@ import os # Fix encoding for emojis/unicode output sys.stdout.reconfigure(encoding='utf-8') -def log_message(query, sender, message_id): - """ - Logs a new message to the Python logging server. - """ - try: - payload = { - "sender": sender, - "query": query, - "message_id": message_id - } - - response = requests.post("http://localhost:5000/save_message", json=payload) - response.raise_for_status() - print("✅ Message successfully sent to logging server.") - except requests.exceptions.RequestException as e: - print(f"❌ Error sending message to logging server: {e}") - except Exception as e: - print(f"❌ An unexpected error occurred: {e}") - -def edit_message(message_id, new_content): - """ - Sends an updated message to the Python logging server. - """ - try: - payload = { - "message_id": message_id, - "new_content": new_content - } - response = requests.post("http://localhost:5000/edit_message", json=payload) - response.raise_for_status() - print("✅ Edited message successfully sent to logging server.") - except requests.exceptions.RequestException as e: - print(f"❌ Error sending edited message to logging server: {e}") - except Exception as e: - print(f"❌ An unexpected error occurred: {e}") - -if len(sys.argv) < 4: - print("Invalid arguments. Usage: ai.py <query> <sender> <message_id> [action]") +if len(sys.argv) < 3: + print("No query or sender provided.") sys.exit() query = sys.argv[1] sender = sys.argv[2] -message_id = sys.argv[3] -action = sys.argv[4] if len(sys.argv) > 4 else "log" -if action == "edit": - edit_message(message_id, query) -elif action == "log": - log_message(query, sender, message_id) -else: - print("Invalid action. Supported actions are 'log' and 'edit'.") +try: + # Send the message data to the Python logging server + payload = { + "sender": sender, + "query": query + } + + response = requests.post("http://localhost:5000/save_message", json=payload) + response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) + + print("✅ Message successfully sent to logging server.") + +except requests.exceptions.RequestException as e: + print(f"❌ Error sending message to logging server: {e}") +except Exception as e: + print(f"❌ An unexpected error occurred: {e}") diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHR.json b/baileys_auth_info/app-state-sync-key-AAAAADHR.json @@ -0,0 +1 @@ +{"keyData":"aAhwSAEIHQB1SPXdGoVhGlN7QjpEM+F2N9pVwXzevj8=","fingerprint":{"rawId":1264993325,"currentIndex":1,"deviceIndexes":[0,1]},"timestamp":"1740488510673"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHS.json b/baileys_auth_info/app-state-sync-key-AAAAADHS.json @@ -0,0 +1 @@ +{"keyData":"r+Ak+sb1XLy3pNFKgNcK6j3VaRmECt2oic0tERTX+XU=","fingerprint":{"rawId":1264993325,"currentIndex":2,"deviceIndexes":[0,1,2]},"timestamp":"1743137318195"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHT.json b/baileys_auth_info/app-state-sync-key-AAAAADHT.json @@ -0,0 +1 @@ +{"keyData":"mT2ZYCSFYta6mT37xuHitGhrgStkEMsSKU35SGyEKDY=","fingerprint":{"rawId":1264993325,"currentIndex":2,"deviceIndexes":[0,1]},"timestamp":"1745295429601"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHU.json b/baileys_auth_info/app-state-sync-key-AAAAADHU.json @@ -0,0 +1 @@ +{"keyData":"FLcVl6ARUCof3CteI9BVGXgzsPIHDWpDZOPk3adz5GQ=","fingerprint":{"rawId":1264993325,"currentIndex":2,"deviceIndexes":[0,1]},"timestamp":"1747887640509"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHV.json b/baileys_auth_info/app-state-sync-key-AAAAADHV.json @@ -0,0 +1 @@ +{"keyData":"dHMW7WwqSXj9DFF9X2RW4D0/HtOMdSz2cRrucISApKw=","fingerprint":{"rawId":1264993325,"currentIndex":2,"deviceIndexes":[0,1]},"timestamp":"0"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHW.json b/baileys_auth_info/app-state-sync-key-AAAAADHW.json @@ -0,0 +1 @@ +{"keyData":"yg5uYI6i+89EMFWBN3OVzcrowOcvFYSP2KbdWhE+nV0=","fingerprint":{"rawId":1264993325,"currentIndex":3,"deviceIndexes":[0,1]},"timestamp":"0"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHX.json b/baileys_auth_info/app-state-sync-key-AAAAADHX.json @@ -0,0 +1 @@ +{"keyData":"zsKBCDXpYAmpFXLDSpuhuFW8iPtrm4U0kCq5pAWerhE=","fingerprint":{"rawId":1264993325,"currentIndex":4,"deviceIndexes":[0,1]},"timestamp":"1751595351340"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHY.json b/baileys_auth_info/app-state-sync-key-AAAAADHY.json @@ -0,0 +1 @@ +{"keyData":"/vdCYwDcVeTZOEvlNxIjIHQohqgOnneb8VjOcM2uKUo=","fingerprint":{"rawId":1264993325,"currentIndex":5,"deviceIndexes":[0,5]},"timestamp":"1752252736115"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHZ.json b/baileys_auth_info/app-state-sync-key-AAAAADHZ.json @@ -0,0 +1 @@ +{"keyData":"fh4lRClm4+4KFdgiTD0O76SFts/Duba9jAx9QKG04Fo=","fingerprint":{"rawId":1264993325,"currentIndex":5,"deviceIndexes":[0,5]},"timestamp":"1754915180519"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHa.json b/baileys_auth_info/app-state-sync-key-AAAAADHa.json @@ -0,0 +1 @@ +{"keyData":"kVUA3TBQwGxpdkRlRT9Nk08/g/HEuhV2S+rpXdCBUyg=","fingerprint":{"rawId":1264993325,"currentIndex":6,"deviceIndexes":[0,5,6]},"timestamp":"0"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHb.json b/baileys_auth_info/app-state-sync-key-AAAAADHb.json @@ -0,0 +1 @@ +{"keyData":"qeC7pcGdHWDP6gW1is+kwXGEYdcPVLCgZeGuevhibpc=","fingerprint":{"rawId":1264993325,"currentIndex":6,"deviceIndexes":[0,5]},"timestamp":"0"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHc.json b/baileys_auth_info/app-state-sync-key-AAAAADHc.json @@ -0,0 +1 @@ +{"keyData":"+NHQmh2K6ux+A/twE7JZ01ghCWiBAxja0AGJr3Djmc0=","fingerprint":{"rawId":1264993325,"currentIndex":7,"deviceIndexes":[0,5]},"timestamp":"0"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHd.json b/baileys_auth_info/app-state-sync-key-AAAAADHd.json @@ -0,0 +1 @@ +{"keyData":"2fsEm/N/mhYCOk5oRCkl0jqXggY5a+Vg9ADl9TXCm+Q=","fingerprint":{"rawId":1264993325,"currentIndex":8,"deviceIndexes":[0,5]},"timestamp":"0"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHe.json b/baileys_auth_info/app-state-sync-key-AAAAADHe.json @@ -0,0 +1 @@ +{"keyData":"HGvtkhH01xGJr4fJIUQCUSAX57PZHJBsEfWj7EZKNaM=","fingerprint":{"rawId":1264993325,"currentIndex":9,"deviceIndexes":[0,5]},"timestamp":"0"}+ \ No newline at end of file diff --git a/baileys_auth_info/app-state-sync-key-AAAAADHf.json b/baileys_auth_info/app-state-sync-key-AAAAADHf.json @@ -0,0 +1 @@ +{"keyData":"vXt/Oikft7bUJt/s3TjCDJK8R4xS1AAjDp7RosYyzwg=","fingerprint":{"rawId":1264993325,"currentIndex":10,"deviceIndexes":[0,5]},"timestamp":"1758888036354"}+ \ No newline at end of file diff --git a/baileys_auth_info/creds.json b/baileys_auth_info/creds.json @@ -0,0 +1 @@ +{"noiseKey":{"private":{"type":"Buffer","data":"6EANeU7RbxH9bkFXIRKJfUjZy4CtZLiUice+6wW9V1s="},"public":{"type":"Buffer","data":"3aKVSRJrDU4tFFOsLigvhApFMNbZDOyaJegT55MYxAE="}},"pairingEphemeralKeyPair":{"private":{"type":"Buffer","data":"kArTywh30G4FCUQWIob9dELRBeL9SRqV1r7Ouc9DBW8="},"public":{"type":"Buffer","data":"2rpEgUuiaNiDGCUHcQSC+a6drvtzn+Kty5ioicMP2HU="}},"signedIdentityKey":{"private":{"type":"Buffer","data":"CB5wk6o03B3pG67XJMYx7aj+3pRQCcJvXXdGuv4EmHk="},"public":{"type":"Buffer","data":"hpuIMcHetgy/s+MOpSOxMjeGqxIkpO9l4Y3x0tKH4Ss="}},"signedPreKey":{"keyPair":{"private":{"type":"Buffer","data":"YObTy2MVKYW5fv5r2r5nbB2rUjcHvZIOO7Yvzp6cxVQ="},"public":{"type":"Buffer","data":"t1WgDT5ZC7h27fRBcuwa47KCk0iy77FzbZaDJjwASW0="}},"signature":{"type":"Buffer","data":"l+l2Ay+GeTWxw7ORlAppf3FE4ku8oaPGRIPvvVJ3t2zndte+RqOLyLKykQ/8wedCDTOxGG+nDORdMF5q/0cdgQ=="},"keyId":1},"registrationId":118,"advSecretKey":"wwlh/3Z3fw3whjySqQ7QAiAYlohA1ERz0Tvs4CqiAPs=","processedHistoryMessages":[],"nextPreKeyId":31,"firstUnuploadedPreKeyId":31,"accountSyncCounter":0,"accountSettings":{"unarchiveChats":false},"registered":false,"account":{"details":"CK2ImdsEEOmA2sYGGAsgACgA","accountSignatureKey":"UpgGYpzwDEIKqC8UDIMWHlQ24zbSw+DHAs2hQXUysC4=","accountSignature":"NYhboDOR+3RWjJ8qkSfTklwKFm1rHYTUvE2DBQXhSPUE5wp4NA+4NST14copDrK2Qmh7mTa2SaIeKeenQd7uDQ==","deviceSignature":"D5V05Pn3gVIDmmHxHGNiNuur1L8B2KBVIERNDHIIODdVQB1SheQ6kKjPc57aJC3fWG3yLN9ZBMKwlN0qSBn5gw=="},"me":{"id":"917278779512:19@s.whatsapp.net","lid":"201554426618024:19@lid"},"signalIdentities":[{"identifier":{"name":"917278779512:19@s.whatsapp.net","deviceId":0},"identifierKey":{"type":"Buffer","data":"BVKYBmKc8AxCCqgvFAyDFh5UNuM20sPgxwLNoUF1MrAu"}}],"platform":"android","routingInfo":{"type":"Buffer","data":"CA0IBQ=="},"lastAccountSyncTimestamp":1758888047,"myAppStateKeyId":"AAAAADHZ","lastPropHash":"3fYwCK"}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-1.json b/baileys_auth_info/pre-key-1.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"UIS2pEEvMjfia8xyHyLtBQec8BZhgpv7rztimpjJxmo="},"public":{"type":"Buffer","data":"C2rLun7FrSRxyUeWs8806TM/Jt+0jC28fBzQ5DOJfE0="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-10.json b/baileys_auth_info/pre-key-10.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"0COGtETLMffuU8WncrEQR4D9Z+XOBF5RizpAP2ibdVU="},"public":{"type":"Buffer","data":"StH+itchL/sXzZVx2C22oTG+O8m6zKtU+6jcPDfNqic="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-11.json b/baileys_auth_info/pre-key-11.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"AOp2oK/Tq9H3d8uMZr6lR9pjSEiTyEYSFSn7e43z5Ww="},"public":{"type":"Buffer","data":"uExdNGsL4RkrFyeLGMewLL0prrcbP8kLwdGuT1R5ckQ="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-12.json b/baileys_auth_info/pre-key-12.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"COjpPvgicMHMBH8k0O0J+ru1T4MG1DyNN0Lgp2kGA3o="},"public":{"type":"Buffer","data":"/mJrJVYtZLBsT5jT8GJxIZRI0axTqgIk9E32kfbYNC8="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-13.json b/baileys_auth_info/pre-key-13.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"oAXRoBwSNHzLpCz0KX3K6bNTIfjSWzi/nKY8IpmnFUQ="},"public":{"type":"Buffer","data":"lB6lt9tGoi70e3D7cabjLKlVGz2upa3NzYxVIPzYfXI="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-14.json b/baileys_auth_info/pre-key-14.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"QKz61lHQEudQhl44NlS7CYc7CEsnjKpUuDTfiNXP1Ww="},"public":{"type":"Buffer","data":"cE+gqD7qaC1LDiNA4FvPEP+WnNk+Zqm6jDwPJCGnwRg="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-15.json b/baileys_auth_info/pre-key-15.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"gAmp2lPJYssW73pqlxrEwrr7SO9Hxt6C2s4vOg8x+lU="},"public":{"type":"Buffer","data":"WQmnpAk/9Rz953/7N7gCJY1YfpjY32LkP6/kCMe6hSM="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-16.json b/baileys_auth_info/pre-key-16.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"ALfaQhN/a+M003MthD9HM9RRgT7w3aqzJ7tpbsSKREI="},"public":{"type":"Buffer","data":"RbkS+Jcdl4R1FTSAwI0bVbcbBDhCGdXxm+sGExVnPwI="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-17.json b/baileys_auth_info/pre-key-17.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"mLt3xcWK0iEUyng+WwMXp5VuCLDYmXRnbzCBg2CyPGc="},"public":{"type":"Buffer","data":"HsPf3U3/vuBroHf6HqpJQPdnSVPWycfGky7QbCxKUzk="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-18.json b/baileys_auth_info/pre-key-18.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"+PqylnqCwYFHvboOqOho4PgprrgFU9rG9uy2etzwf30="},"public":{"type":"Buffer","data":"HYL0EPKj5MjfOXJKkhC2eJwhB4i0DJ+pN8b3j9KAfWk="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-19.json b/baileys_auth_info/pre-key-19.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"IMafYtcrmL3kg9GFGXwJeEX7umpac68NCneuraBrCVs="},"public":{"type":"Buffer","data":"ryGfGUtJFejlblTbpO3cR+Ivo4zq1TryFjXCR5bsHGk="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-2.json b/baileys_auth_info/pre-key-2.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"gEpN5LsSqNopjfaar7SDFT1iI+56ftUEKeaH/kmBgGg="},"public":{"type":"Buffer","data":"QZOlXJkVTTsEVGzVf/aeaDImk/phAmd6lQ1Dy61I7xY="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-20.json b/baileys_auth_info/pre-key-20.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"uHJ7iT6iaVxH6UGubKWQuszDoBAJcWSUvzBc1H0y7mM="},"public":{"type":"Buffer","data":"qpY79bD2mm5R5dRQOLmLVfhMl3ZsjrME8XWCaWqMM2A="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-21.json b/baileys_auth_info/pre-key-21.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"qFMIU6hbKK8OyuteyH/+h3wQVGkCUHA89bVtJDcCdkY="},"public":{"type":"Buffer","data":"9IbLH3+CdczdAwzu1kGxVhP1Xp/X9zVDIOCKpxWgtC4="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-22.json b/baileys_auth_info/pre-key-22.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"WE8CbrucX8XCUVeFttRKnCrAM6OQ/pVB5C1YBkVCTVY="},"public":{"type":"Buffer","data":"O+5legHvHLFoeEcorpe5hxljyUjxk6fxNh3NMW7pfzg="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-23.json b/baileys_auth_info/pre-key-23.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"6Mee3uCZQGQQsS9E+oTMAnht6V5u2ZZhk5qhpTL0IHI="},"public":{"type":"Buffer","data":"tiOS+q48K0SeiG5Dkj+deJeJN7IeXQh/fIFY8gnDfSY="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-24.json b/baileys_auth_info/pre-key-24.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"0EuOAI5W6Qoi8HtNZQa6jTFLt6LEdwW0WQqzBVn2wXE="},"public":{"type":"Buffer","data":"oQ3juScqR/hmEZ1TnDgy3kOz0rUEluK2igKOk1JKbAI="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-25.json b/baileys_auth_info/pre-key-25.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"qNIGGF4C/0cDAC2eQe2Zt183rqnz6Ut6EDg3pT+i8m4="},"public":{"type":"Buffer","data":"RNY5lyT2iFUx/hWIfBEmOQEo0KiFOeY33URfFHij62s="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-26.json b/baileys_auth_info/pre-key-26.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"8CyhlWrWNkUvSGWmOzyv2es0ReJOPtaoI1spvX94EU0="},"public":{"type":"Buffer","data":"nAKCvnbL1BGdOredMazLMD79PuUdkMVrgZ0p7USpWXE="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-27.json b/baileys_auth_info/pre-key-27.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"YAGSLU09Pxy5kdhqm0KtUmNunepmdKWsO/ibMXouKkE="},"public":{"type":"Buffer","data":"tg7F0FaJOG6hMy7YLfH+tJtzUBd7ypb3NHFTiDaA/0I="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-28.json b/baileys_auth_info/pre-key-28.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"yM+bigYQvd4XmEHct79S0DgcV7zEsbeebyZJWrjTAEI="},"public":{"type":"Buffer","data":"d8qayNviSB2a/3q2OR9Vftb7mFcfNxsICclEflo3EzQ="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-29.json b/baileys_auth_info/pre-key-29.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"gO1Ur8G2IbUsbosxbPWWujBd6AEosYS0otKrmEl3D20="},"public":{"type":"Buffer","data":"7RzLK5XKLhse0tF6/khEJt6traFbncdWnxiHqvuAhGc="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-30.json b/baileys_auth_info/pre-key-30.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"0CCjbFq2J2NjHxxHbRsTIeZf//d4CdRazqmWzQMtT00="},"public":{"type":"Buffer","data":"7CCer+xgMvBRVkYx1GYee8vGbjiEO1egFBZNHSdRShA="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-4.json b/baileys_auth_info/pre-key-4.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"SGCZj4tZ9MYNcsLY1Xltibo3vhL3JWx1OR9RRO2oeHE="},"public":{"type":"Buffer","data":"sn/SwwhPfRqQiKR3Nji1/YYSY2T41oz3wmljwy8DZDI="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-5.json b/baileys_auth_info/pre-key-5.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"AElD0taZSizYrPFBIeK3xUd0NF0siLhdFedwzVdCNlU="},"public":{"type":"Buffer","data":"fwfp5IN0CJJt8tzNpUz2q+yRCC99GSSMGhsH29a4+wU="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-6.json b/baileys_auth_info/pre-key-6.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"8MaHGt2H0oh3C4wYKWIYh9CrVd9oIM143Je/MNLIEW8="},"public":{"type":"Buffer","data":"5IoTLSxF2oNzlz7Xqe1yzmUwvi6PPsziw/0V/szt8Wo="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-7.json b/baileys_auth_info/pre-key-7.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"yInHD8XKNbZVXuh3S6x3S5sIhhrVICAlOlaDARXBKUI="},"public":{"type":"Buffer","data":"yEw0iLop22Wtj5wdLR4dqDFZNYsmre55Oy/I+Mch8yo="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-8.json b/baileys_auth_info/pre-key-8.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"iJAwc2huAtbNmsnjmWX5vcM2Ac8ufcNMH8XM+UXLbW0="},"public":{"type":"Buffer","data":"tbApsgzcT+lprAIJTqjS/UhCydBskqodJiWqGdhjbwo="}}+ \ No newline at end of file diff --git a/baileys_auth_info/pre-key-9.json b/baileys_auth_info/pre-key-9.json @@ -0,0 +1 @@ +{"private":{"type":"Buffer","data":"oMR2pSPj5TJzJ58thlO6ud5cUVR1bd0WS5lsuEf5Okc="},"public":{"type":"Buffer","data":"FwGCqkdwv5uKuMTT45a6WSNgmV9fFRBtOoH38CW9FXY="}}+ \ No newline at end of file diff --git a/index.js b/index.js @@ -1,5 +1,4 @@ -import { - makeWASocket, +import makeWASocket, { makeCacheableSignalKeyStore, useMultiFileAuthState, DisconnectReason, @@ -18,9 +17,9 @@ const logger = pino().child({ level: "silent" }); const authPath = "./baileys_auth_info"; // Function to run the Python script -const runPythonScript = (text, sender, messageId, action = "log") => { +const runPythonScript = (text, sender, senderName) => { // Execute the Python script "ai.py" to handle the message. - execFile('python', ['ai.py', text, sender, messageId, action], (error, stdout, stderr) => { + execFile('python', ['ai.py', text, sender, senderName], (error, stdout, stderr) => { if (error) { console.error("❌ Python Error:", error.message); return; @@ -106,25 +105,10 @@ const startSock = async () => { const sender = msg.key.remoteJid; const senderName = msg.pushName || sender; const text = msg.message.conversation || msg.message.extendedTextMessage?.text; - const messageId = msg.key.id; if (text) { console.log(`📥 From ${senderName} (${sender}): ${text}`); - runPythonScript(text, sender, messageId); - } - } - }); - - // Listen for edited messages - sock.ev.on("messages.update", async (messages) => { - const message = messages[0]; - if (message.update.edited) { - const updatedText = message.update.edited.message.extendedTextMessage?.text; - const originalMessageId = message.key.id; - - if (updatedText) { - console.log(`✏️ Edited message from ${message.key.remoteJid}: ${updatedText}`); - runPythonScript(updatedText, message.key.remoteJid, originalMessageId, "edit"); + runPythonScript(text, sender, senderName); } } });