python-xmpp-bot

A simple python-based XMPP bot.
git clone https://git.sr.ht/~jbauer/python-xmpp-bot
Log | Files | Refs | README | LICENSE

commit 1968e293962ba25bbb420913aec5cf13dd8fa55d
parent c50f9f78f488930cf83788ca81118e42e8631428
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Sun, 29 Nov 2020 05:11:39 -0500

Fix restart command after file split

Diffstat:
Mbot.py | 8++++----
Mrun.py | 6+++---
2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/bot.py b/bot.py @@ -33,6 +33,8 @@ class Bot: self.rooms = [] self.eightBallResponses = [] self.admins = [] + self.restarting = False + self.invoker = "" def register_handlers(self): self.jabber.RegisterHandler('message',self.xmpp_message) @@ -231,10 +233,8 @@ class Bot: self.send_message(recipient, message, typ) def command_restart(self, recipient, typ): - global restarting - global invoker - restarting = True - invoker = recipient + self.restarting = True + self.invoker = recipient message = "Restarting..." self.send_message(recipient, message, typ) self.announce("Restarting...") diff --git a/run.py b/run.py @@ -47,11 +47,11 @@ def main(): bot = start_bot() while True: - if restarting: + if bot.restarting: + invoker = bot.invoker bot.jabber.disconnect() - start_bot() + bot = start_bot() bot.send_message(invoker, "Bot restarted!", typ="chat") - restarting = False try: if not bot.jabber.isConnected(): bot.jabber.reconnectAndReauth()