Work in the directory where hptoad.py is located

This commit is contained in:
Alexei Sorokin 2016-08-24 02:16:37 +03:00
parent 633a023580
commit 96c975233c
1 changed files with 7 additions and 2 deletions

View File

@ -160,7 +160,7 @@ class Zhobe:
reply = "%s: GTFO" % nick
elif body.startswith("!"): # Any external command.
reply, err = self.extern_cmd(body, nick, from_id, "./plugins",
reply, err = self.extern_cmd(body, nick, from_id, "plugins",
is_admin=is_admin)
return reply, err
@ -190,7 +190,7 @@ class Zhobe:
elif call_regexp.match(body): # Chat.
cmd_body = call_regexp.sub("!answer", body)
reply, err = self.extern_cmd(cmd_body, nick, from_id, "./chat",
reply, err = self.extern_cmd(cmd_body, nick, from_id, "chat",
is_admin=is_admin)
if err:
@ -277,11 +277,16 @@ class Zhobe:
if __name__ == "__main__":
signal.signal(signal.SIGINT, signal.SIG_DFL)
logging.basicConfig(level=logging.DEBUG,
format="%(asctime)s %(message)s",
datefmt="%Y/%m/%d %H:%M:%S")
# Silence sleekxmpp debug information.
logging.getLogger("sleekxmpp").setLevel(logging.CRITICAL)
if os.path.isfile(sys.argv[0]) and os.path.dirname(sys.argv[0]):
os.chdir(os.path.dirname(sys.argv[0]))
zhobe = Zhobe(opts)
while True:
zhobe.run()