@@ -4,7 +4,7 @@
"""
"""
EarwigBot
EarwigBot
A thin wrapper for EarwigBot's main bot code, located in core/main.py . This
A thin wrapper for EarwigBot's main bot code, specified by bot_script . This
wrapper will automatically restart the bot when it shuts down (from !restart,
wrapper will automatically restart the bot when it shuts down (from !restart,
for example). It requests the bot's password at startup and reuses it every
for example). It requests the bot's password at startup and reuses it every
time the bot restarts internally, so you do not need to re-enter the password
time the bot restarts internally, so you do not need to re-enter the password
@@ -16,6 +16,7 @@ markdown format!) and the LICENSE for licensing information.
from getpass import getpass
from getpass import getpass
from subprocess import Popen, PIPE
from subprocess import Popen, PIPE
from os import path
from sys import executable
from sys import executable
from time import sleep
from time import sleep
@@ -27,6 +28,8 @@ __license__ = "MIT License"
__version__ = "0.1dev"
__version__ = "0.1dev"
__email__ = "ben.kurtovic@verizon.net"
__email__ = "ben.kurtovic@verizon.net"
bot_script = path.join(path.dirname(path.abspath(__file__)), "core", "main.py")
def main():
def main():
print "EarwigBot v{0}\n".format(__version__)
print "EarwigBot v{0}\n".format(__version__)
@@ -37,7 +40,7 @@ def main():
key = None
key = None
while 1:
while 1:
bot = Popen([executable, 'core/main.py' ], stdin=PIPE)
bot = Popen([executable, bot_script ], stdin=PIPE)
bot.communicate(key) # give the key to core.config.load()
bot.communicate(key) # give the key to core.config.load()
return_code = bot.wait()
return_code = bot.wait()
if return_code == 1:
if return_code == 1: