restart if fail
This commit is contained in:
parent
1bed274476
commit
21532c005d
@ -7,10 +7,10 @@ host = '0.0.0.0'
|
|||||||
port = 7747
|
port = 7747
|
||||||
addr = (host,port)
|
addr = (host,port)
|
||||||
|
|
||||||
irc_host = 's1.tomasgl.piv'
|
irc_host = 's1.tomas.gl'
|
||||||
irc_port = 6667
|
irc_port = 6667
|
||||||
irc_chat_name = '#notifications'
|
irc_chat_name = '#notifications'
|
||||||
irc_bot_nickname = 'GandC_LogMon_Bot'
|
irc_bot_nickname = 'Test_BOT'
|
||||||
|
|
||||||
s = socket(AF_INET, SOCK_DGRAM) # Socket creation
|
s = socket(AF_INET, SOCK_DGRAM) # Socket creation
|
||||||
s.bind(addr) # Bind socket to ip
|
s.bind(addr) # Bind socket to ip
|
||||||
@ -23,7 +23,7 @@ def on_join(connection, event):
|
|||||||
connection.privmsg(irc_chat_name, 'Bot started')
|
connection.privmsg(irc_chat_name, 'Bot started')
|
||||||
|
|
||||||
def on_disconnect(connection, event):
|
def on_disconnect(connection, event):
|
||||||
exit()
|
exit(1)
|
||||||
|
|
||||||
reactor = client.Reactor()
|
reactor = client.Reactor()
|
||||||
irc = reactor.server()
|
irc = reactor.server()
|
||||||
@ -31,7 +31,8 @@ irc.connect(irc_host, irc_port, irc_bot_nickname)
|
|||||||
irc.add_global_handler("welcome", on_connect)
|
irc.add_global_handler("welcome", on_connect)
|
||||||
irc.add_global_handler("join", on_join)
|
irc.add_global_handler("join", on_join)
|
||||||
irc.add_global_handler('disconnect', on_disconnect)
|
irc.add_global_handler('disconnect', on_disconnect)
|
||||||
Thread(target=reactor.process_forever).start()
|
while True:
|
||||||
|
Thread(target=reactor.process_forever).start()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
message, addr = s.recvfrom(1024) # receive message
|
message, addr = s.recvfrom(1024) # receive message
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user