From 203bcdba5ed9471ffe9731d23b7c4e858c180013 Mon Sep 17 00:00:00 2001 From: prachi Date: Mon, 18 May 2020 21:48:54 +0530 Subject: [PATCH] Added config file for own address --- README.md | 4 ++-- autoresponder_mailing.py | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 533818d..4691665 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PyBitMessage_AutoResponder -The aim of this python script is to run an bitmessages application automatically.This script will monitor the reponses from Responder and perform accordingly. +The aim of this python script is to run bitmessages application automatically.This script will monitor the reponses from Responder and perform accordingly. This script loads all the inbox messages and sent response automatically to each messages.They are triggered based on rules and time intervals that are defined. @@ -26,7 +26,7 @@ Before running this script please run the bitmessages application, because if yo Configuration Steps -1.put the credentials.ini file into the .config directory which contains the database of bitmessage application. +1.Put the credentials.ini file into the .config directory which contains the database of bitmessage application. 2.To establish a connection, copy and paste these lines into the bitmessagesettings section of the keys.dat file.Note that the values "username" and "password" below are merely examples, and should be replaced by values that cannot feasibly be guessed: --> apienabled = true diff --git a/autoresponder_mailing.py b/autoresponder_mailing.py index b5b31cd..f5879c7 100644 --- a/autoresponder_mailing.py +++ b/autoresponder_mailing.py @@ -16,10 +16,18 @@ class BitmessageAutoresponder(): apipassword = config['sqlite3']['apipassword'] api = xmlrpclib.ServerProxy("http://%s:%s@%s:%s/"%(apiusername, apipassword, apiinterface, apiport)) expire = 300 + myaddress_path = os.path.join(os.environ["HOME"],'.config/PyBitmessage/keys.dat') def send_autorepond_inbox_message(self): """Sending Auto Message To The Recipient""" track = {} + open_file = open(self.myaddress_path) + get_file = open_file.read() + split_file = get_file.split("\n") + for lines in split_file: + if len(lines) == 39: + if "[" in lines: + set_address=lines.strip("[]") while True: inboxmessages = json.loads(self.api.getAllInboxMessages()) inbox_var = inboxmessages.get('inboxMessages') @@ -35,7 +43,7 @@ class BitmessageAutoresponder(): continue except KeyError: pass - if toaddress == fromaddress: + if set_address == toaddress: continue self.api.sendMessage(toaddress, fromaddress, subject, message) self.api.trashMessage(msgid)