Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket #imports module allowing connection to IRC
- import threading #imports module allowing timing functions
- #sets variables for connection to twitch chat
- bot_owner = 'DevinP6576'
- nick = 'devin6576_bot'
- channel = 'DevinP6576'
- server = 'irc.twitch.tv'
- password = 'oauth:8y8u6m85ksyzhcchfrdym4o475idor'
- queue = 13 #sets variable for anti-spam queue functionality
- irc = socket.socket()
- irc.connect((server, 6667)) #connects to the server
- #sends variables for connection to twitch chat
- irc.send('PASS ' + password + '\r\n')
- irc.send('USER ' + nick + ' 0 * :' + bot_owner + '\r\n')
- irc.send('NICK ' + nick + '\r\n')
- irc.send('JOIN ' + channel + '\r\n')
- while True:
- babadata = irc.recv(1204) #gets output from IRC server
- babauser = babadata.split(':')[1]
- babauser = babauser.split('!')[0] #determines the sender of the messages
- print (babadata)
- if babadata.find('PING') != -1:
- irc.send(babadata.replace('PING', 'PONG')) #responds to PINGS from the server
- user = getUser(line)
- message = getMessage(line)
- print (user) + " typed :" + message
- if "hi" in message:
- sendMessage(s, "Hi!")
- break
Add Comment
Please, Sign In to add comment