1
0
Fork 0
forked from swee/MeowNex

change the way bot restarts, 2 others

* fix $welcome
* change version
This commit is contained in:
Nova Cat 2024-11-17 15:07:44 -08:00
parent 2eb86d97bd
commit 41ed4a1090

View file

@ -1,4 +1,4 @@
__version__ = "0.0.1 Link parser update" __version__ = "0.0.2 Funni update"
import socket import socket
import subprocess import subprocess
from time import sleep, time, ctime from time import sleep, time, ctime
@ -235,12 +235,11 @@ 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 from sys import exit
def restart(): def restart():
irc.irc_socket.close() irc.irc_socket.close()
irc2.irc_socket.close() irc2.irc_socket.close()
irc3.irc_socket.close() irc3.irc_socket.close()
ossystem("python " + " ".join(argv))
exit(0) exit(0)
def system(cmd, chan): def system(cmd, chan):
try: try:
@ -254,9 +253,9 @@ def system(cmd, chan):
multiline(cmd[0] + " not found", chan) multiline(cmd[0] + " not found", chan)
except: except:
multiline(traceback.format_exc()) multiline(traceback.format_exc())
irl2 = threading.Thread(target=irci2) irl2 = threading.Thread(target=irci2, daemon=True)
irl2.start() irl2.start()
irl3 = threading.Thread(target=irci3) irl3 = threading.Thread(target=irci3, daemon=True)
irl3.start() irl3.start()
while True: while True:
teext = irc.response_irc().split("\r\n") teext = irc.response_irc().split("\r\n")
@ -327,10 +326,11 @@ while True:
irc.send_irc(channel, nick + ": " + username) irc.send_irc(channel, nick + ": " + username)
elif command[0] == "$welcome": elif command[0] == "$welcome":
name = nick if not len(command) > 1 else " ".join(command[1:])
if random(1,2) == 1: if random(1,2) == 1:
irc.send_irc(channel, "Heyo! Welcome to the channel," + command[1]) irc.send_irc(channel, "Heyo! Welcome to the channel, {name}")
else: else:
irc.send_irc(channel, "Welcome, " + command[1]) irc.send_irc(channel, "Welcome, {name}")
elif command[0] == "$perms": elif command[0] == "$perms":
if len(command) == 2: if len(command) == 2: