Don't fail the build if sending the IRC notification fails
This commit is contained in:
parent
8cfd128543
commit
19167ca3be
1 changed files with 30 additions and 25 deletions
|
@ -129,32 +129,37 @@ if __name__ == '__main__':
|
|||
irc_username = 'Appveyor'
|
||||
irc_nick = irc_username + str(random.randint(1, 9999))
|
||||
|
||||
# establish connection
|
||||
irc_sock = ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
|
||||
irc_sock.connect((socket.gethostbyname('chat.freenode.net'), 6697))
|
||||
irc_sock.send('NICK {0}\r\nUSER {0} * 0 :{0}\r\n'.format(irc_username).encode())
|
||||
irc_file = irc_sock.makefile()
|
||||
try:
|
||||
# establish connection
|
||||
irc_sock = ssl.wrap_socket(socket.socket(socket.AF_INET, socket.SOCK_STREAM))
|
||||
irc_sock.connect((socket.gethostbyname('chat.freenode.net'), 6697))
|
||||
irc_sock.send('NICK {0}\r\nUSER {0} * 0 :{0}\r\n'.format(irc_username).encode())
|
||||
irc_file = irc_sock.makefile()
|
||||
|
||||
while irc_file:
|
||||
line = irc_file.readline()
|
||||
print(line.rstrip())
|
||||
response = line.split()
|
||||
while irc_file:
|
||||
line = irc_file.readline()
|
||||
print(line.rstrip())
|
||||
response = line.split()
|
||||
|
||||
if response[0] == 'PING':
|
||||
irc_file.send('PONG {}\r\n'.format(reponse[1]).encode())
|
||||
if response[0] == 'PING':
|
||||
irc_file.send('PONG {}\r\n'.format(reponse[1]).encode())
|
||||
|
||||
elif response[1] == '433':
|
||||
irc_sock.send('NICK {}\r\n'.format(irc_nick).encode())
|
||||
elif response[1] == '433':
|
||||
irc_sock.send('NICK {}\r\n'.format(irc_nick).encode())
|
||||
|
||||
elif response[1] == '001':
|
||||
time.sleep(5)
|
||||
# join the channel
|
||||
irc_sock.send('JOIN #{}\r\n'.format(channel).encode())
|
||||
# send messages
|
||||
for msg in messages:
|
||||
print('PRIVMSG #{} :{}'.format(channel, msg))
|
||||
irc_sock.send('PRIVMSG #{} :{}\r\n'.format(channel, msg).encode())
|
||||
time.sleep(5)
|
||||
# leave the channel
|
||||
irc_sock.send('PART #{}\r\n'.format(channel).encode())
|
||||
sys.exit()
|
||||
elif response[1] == '001':
|
||||
time.sleep(5)
|
||||
# join the channel
|
||||
irc_sock.send('JOIN #{}\r\n'.format(channel).encode())
|
||||
# send messages
|
||||
for msg in messages:
|
||||
print('PRIVMSG #{} :{}'.format(channel, msg))
|
||||
irc_sock.send('PRIVMSG #{} :{}\r\n'.format(channel, msg).encode())
|
||||
time.sleep(5)
|
||||
# leave the channel
|
||||
irc_sock.send('PART #{}\r\n'.format(channel).encode())
|
||||
sys.exit()
|
||||
except:
|
||||
e = sys.exc_info()[0]
|
||||
print(e)
|
||||
sys.exit()
|
||||
|
|
Loading…
Add table
Reference in a new issue