Work in the directory where hptoad.py is located
This commit is contained in:
parent
633a023580
commit
96c975233c
|
@ -160,7 +160,7 @@ class Zhobe:
|
||||||
reply = "%s: GTFO" % nick
|
reply = "%s: GTFO" % nick
|
||||||
|
|
||||||
elif body.startswith("!"): # Any external command.
|
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)
|
is_admin=is_admin)
|
||||||
|
|
||||||
return reply, err
|
return reply, err
|
||||||
|
@ -190,7 +190,7 @@ class Zhobe:
|
||||||
|
|
||||||
elif call_regexp.match(body): # Chat.
|
elif call_regexp.match(body): # Chat.
|
||||||
cmd_body = call_regexp.sub("!answer", body)
|
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)
|
is_admin=is_admin)
|
||||||
|
|
||||||
if err:
|
if err:
|
||||||
|
@ -277,11 +277,16 @@ class Zhobe:
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG,
|
logging.basicConfig(level=logging.DEBUG,
|
||||||
format="%(asctime)s %(message)s",
|
format="%(asctime)s %(message)s",
|
||||||
datefmt="%Y/%m/%d %H:%M:%S")
|
datefmt="%Y/%m/%d %H:%M:%S")
|
||||||
# Silence sleekxmpp debug information.
|
# Silence sleekxmpp debug information.
|
||||||
logging.getLogger("sleekxmpp").setLevel(logging.CRITICAL)
|
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)
|
zhobe = Zhobe(opts)
|
||||||
while True:
|
while True:
|
||||||
zhobe.run()
|
zhobe.run()
|
||||||
|
|
Loading…
Reference in New Issue