forked from swee/MeowNex
Update sweebot.py
This commit is contained in:
parent
a30af3c37a
commit
4ae2f5b4ce
1 changed files with 11 additions and 4 deletions
15
sweebot.py
15
sweebot.py
|
@ -168,7 +168,7 @@ irc = bot_irc()
|
||||||
irc2 = bot_irc()
|
irc2 = bot_irc()
|
||||||
irc3 = bot_irc()
|
irc3 = bot_irc()
|
||||||
irc.connect_irc(
|
irc.connect_irc(
|
||||||
server_irc, port_irc, channel_irc, botnick_irc, botpass_irc, botnickpass_irc
|
server_irc, port_irc, channel_irc, botnick_irc, botpass_irc, botnickpass_irc + "/A"
|
||||||
)
|
)
|
||||||
sbconfig = config()
|
sbconfig = config()
|
||||||
threes = [":3", ":3c", "uwu", "owo", "/ᐠ。ꞈ。ᐟ\\", "(✿◠‿◠)"]
|
threes = [":3", ":3c", "uwu", "owo", "/ᐠ。ꞈ。ᐟ\\", "(✿◠‿◠)"]
|
||||||
|
@ -184,13 +184,13 @@ def update():
|
||||||
update()
|
update()
|
||||||
def irci2():
|
def irci2():
|
||||||
irc2.connect_irc(
|
irc2.connect_irc(
|
||||||
server_irc, port_irc, channel_irc, "sweeB0t", botpass_irc, botnickpass_irc + "/secondary"
|
server_irc, port_irc, channel_irc, "sweeB0t", botpass_irc, botnickpass_irc + "/B"
|
||||||
)
|
)
|
||||||
while True:
|
while True:
|
||||||
irc2.ping()
|
irc2.ping()
|
||||||
def irci3():
|
def irci3():
|
||||||
irc3.connect_irc(
|
irc3.connect_irc(
|
||||||
server_irc, port_irc, channel_irc, "swe3Bot", botpass_irc, botnickpass_irc + "/tertiary"
|
server_irc, port_irc, channel_irc, "swe3Bot", botpass_irc, botnickpass_irc + "/C"
|
||||||
)
|
)
|
||||||
while True:
|
while True:
|
||||||
irc3.ping()
|
irc3.ping()
|
||||||
|
@ -217,6 +217,13 @@ def multiline(text, channel):
|
||||||
sleep(1)
|
sleep(1)
|
||||||
irc.send_irc(channel, replace_color_codes(t))
|
irc.send_irc(channel, replace_color_codes(t))
|
||||||
times += 1
|
times += 1
|
||||||
|
from sys import argv, exit
|
||||||
|
def restart():
|
||||||
|
irc.irc_socket.close()
|
||||||
|
irc2.irc_socket.close()
|
||||||
|
irc3.irc_socket.close()
|
||||||
|
ossystem("python " + " ".join(argv))
|
||||||
|
exit(0)
|
||||||
def system(cmd, chan):
|
def system(cmd, chan):
|
||||||
try:
|
try:
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
@ -317,7 +324,7 @@ while True:
|
||||||
if perms == "full" or "reboot" in perms.split(",") or "restart" in perms.split(","):
|
if perms == "full" or "reboot" in perms.split(",") or "restart" in perms.split(","):
|
||||||
irc.send_irc(channel, nick + ": Restarting bot...")
|
irc.send_irc(channel, nick + ": Restarting bot...")
|
||||||
sleep(1)
|
sleep(1)
|
||||||
ossystem("sudo systemctl restart sweebot")
|
restart()
|
||||||
else:
|
else:
|
||||||
irc.send_irc(channel, nick + ": Permission denied.")
|
irc.send_irc(channel, nick + ": Permission denied.")
|
||||||
block+=1
|
block+=1
|
||||||
|
|
Loading…
Reference in a new issue