forked from swee/MeowNex
change the way bot restarts, 2 others
* fix $welcome * change version
This commit is contained in:
parent
2eb86d97bd
commit
41ed4a1090
1 changed files with 24 additions and 24 deletions
14
sweebot.py
14
sweebot.py
|
@ -1,4 +1,4 @@
|
|||
__version__ = "0.0.1 Link parser update"
|
||||
__version__ = "0.0.2 Funni update"
|
||||
import socket
|
||||
import subprocess
|
||||
from time import sleep, time, ctime
|
||||
|
@ -235,12 +235,11 @@ def multiline(text, channel):
|
|||
sleep(1)
|
||||
irc.send_irc(channel, replace_color_codes(t))
|
||||
times += 1
|
||||
from sys import argv, exit
|
||||
from sys import 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):
|
||||
try:
|
||||
|
@ -254,9 +253,9 @@ def system(cmd, chan):
|
|||
multiline(cmd[0] + " not found", chan)
|
||||
except:
|
||||
multiline(traceback.format_exc())
|
||||
irl2 = threading.Thread(target=irci2)
|
||||
irl2 = threading.Thread(target=irci2, daemon=True)
|
||||
irl2.start()
|
||||
irl3 = threading.Thread(target=irci3)
|
||||
irl3 = threading.Thread(target=irci3, daemon=True)
|
||||
irl3.start()
|
||||
while True:
|
||||
teext = irc.response_irc().split("\r\n")
|
||||
|
@ -327,10 +326,11 @@ while True:
|
|||
irc.send_irc(channel, nick + ": " + username)
|
||||
|
||||
elif command[0] == "$welcome":
|
||||
name = nick if not len(command) > 1 else " ".join(command[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:
|
||||
irc.send_irc(channel, "Welcome, " + command[1])
|
||||
irc.send_irc(channel, "Welcome, {name}")
|
||||
|
||||
elif command[0] == "$perms":
|
||||
if len(command) == 2:
|
||||
|
|
Loading…
Reference in a new issue