Update sweebridge.py

This commit is contained in:
Nova Cat 2025-01-01 14:34:27 -08:00
parent 09117fe53c
commit cab9376bc2

View file

@ -204,9 +204,9 @@ def ircsession(platform:str, sock:bot_irc):
if content.split(" ")[0] == "b$pull": if content.split(" ")[0] == "b$pull":
updater = subprocess.run(["git", "pull"], stdout=subprocess.PIPE) updater = subprocess.run(["git", "pull"], stdout=subprocess.PIPE)
if updater.stdout.decode().strip() == "Already up to date.": if updater.stdout.decode().strip() == "Already up to date.":
sock.send_irc(channel_irc, "[WARN] SweeBridge is already up-to-date.") sock.send_irc(channel_irc, "[⚠️] SweeBridge is already up-to-date.")
else: else:
sock.send_irc(channel_irc, "[OK] SweeBridge updated, restarting now!") sock.send_irc(channel_irc, "[] SweeBridge updated, restarting now!")
global alive global alive
alive = False alive = False
time.sleep(2) time.sleep(2)
@ -417,6 +417,16 @@ async def on_message(message):
else: else:
if libera_enable: libera.send_irc(libera_channel, "Error: Discord is not set up in this community!") if libera_enable: libera.send_irc(libera_channel, "Error: Discord is not set up in this community!")
await message.reply("Error: Discord is not set up in this community!") await message.reply("Error: Discord is not set up in this community!")
if message.content.split(" ")[0] == "b$pull":
updater = subprocess.run(["git", "pull"], stdout=subprocess.PIPE)
if updater.stdout.decode().strip() == "Already up to date.":
await message.reply("[⚠️] SweeBridge is already up-to-date.")
else:
await message.reply("[✅] SweeBridge updated, restarting now!")
global alive
alive = False
time.sleep(2)
sys.exit()
if message.content[:13] == "b$chandetails" and not message.author.bot: if message.content[:13] == "b$chandetails" and not message.author.bot:
await message.reply("* Server ID: " + message.server.id + "\n* Channel ID: " + message.channel.id) await message.reply("* Server ID: " + message.server.id + "\n* Channel ID: " + message.channel.id)
class MyClient(discord.Client): class MyClient(discord.Client):