Added config file for own address

This commit is contained in:
prachi 2020-05-18 21:48:54 +05:30
parent 16199fc480
commit 203bcdba5e
No known key found for this signature in database
GPG Key ID: 2940E6901747AAAF
2 changed files with 11 additions and 3 deletions

View File

@ -1,6 +1,6 @@
# PyBitMessage_AutoResponder # 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. 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 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: 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 --> apienabled = true

View File

@ -16,10 +16,18 @@ class BitmessageAutoresponder():
apipassword = config['sqlite3']['apipassword'] apipassword = config['sqlite3']['apipassword']
api = xmlrpclib.ServerProxy("http://%s:%s@%s:%s/"%(apiusername, apipassword, apiinterface, apiport)) api = xmlrpclib.ServerProxy("http://%s:%s@%s:%s/"%(apiusername, apipassword, apiinterface, apiport))
expire = 300 expire = 300
myaddress_path = os.path.join(os.environ["HOME"],'.config/PyBitmessage/keys.dat')
def send_autorepond_inbox_message(self): def send_autorepond_inbox_message(self):
"""Sending Auto Message To The Recipient""" """Sending Auto Message To The Recipient"""
track = {} 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: while True:
inboxmessages = json.loads(self.api.getAllInboxMessages()) inboxmessages = json.loads(self.api.getAllInboxMessages())
inbox_var = inboxmessages.get('inboxMessages') inbox_var = inboxmessages.get('inboxMessages')
@ -35,7 +43,7 @@ class BitmessageAutoresponder():
continue continue
except KeyError: except KeyError:
pass pass
if toaddress == fromaddress: if set_address == toaddress:
continue continue
self.api.sendMessage(toaddress, fromaddress, subject, message) self.api.sendMessage(toaddress, fromaddress, subject, message)
self.api.trashMessage(msgid) self.api.trashMessage(msgid)