diff --git a/sweebridge.py b/sweebridge.py index 9ba047e..4e3e795 100644 --- a/sweebridge.py +++ b/sweebridge.py @@ -201,6 +201,16 @@ def ircsession(platform:str, sock:bot_irc): else: sock.send_irc(channel_irc, "Error: Discord isn't set up in this community!") if guilded_enable: hook(gilwebhook, json={"content": "Error: Discord isn't set up in this community!", "username": "SweeBridge Discord", "avatar_url": "https://git.swee.codes/swee/SweeBridge/raw/branch/main/logos/sweebridge-discord.png"}) + if content.split(" ")[0] == "b$pull": + updater = subprocess.run(["git", "pull"], stdout=subprocess.PIPE) + if updater.stdout.decode().strip() == "Already up to date.": + sock.send_irc(channel_irc, "[WARN] SweeBridge is already up-to-date.") + else: + sock.send_irc(channel_irc, "[OK] SweeBridge updated, restarting now!") + global alive + alive = False + time.sleep(2) + sys.exit() elif "QUIT" in text: if guilded_enable: hook(gilwebhook, json={"content": nick + " Has quit for reason \"" + " ".join(text.split(" ")[2:])[1:] + "\"", "username": "SweeBridge IRC", "avatar_url": "https://git.swee.codes/swee/SweeBridge/raw/branch/main/logos/sweebridge-" + platform + ".png"}) if discord_enable: hook(discwebhook, json={"content": nick + " Has quit for reason \"" + " ".join(text.split(" ")[2:])[1:] + "\"", "username": "SweeBridge IRC", "avatar_url": "https://git.swee.codes/swee/SweeBridge/raw/branch/main/logos/sweebridge-" + platform + ".png"})