Advertisement
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
- import time
- import os
- #sets variables for connection to twitch chat
- bot_owner = 'yosofunny'
- nick = 'yosofunny' #Bot Name (Twitch.Tv Bot Name)
- channel = '#siractionslacks' #Stream Channel (Twitch.Tv Stream)
- server = 'irc.twitch.tv' #IRC Server (Server)
- password = 'oauth:pj94mf3ebnb4i9subsh7ny4r5t7t29' #Password (oAuth)
- deaths = 240
- userarray = 'yosofunny',' t765234','oldraiden','The_dopp','vdles','Buttletdota','Happygilman','Heyjobis','Mindz13','Oldraiden','name_name_name_name','Siractionslacks','nlnj_a','Sheepeater_1701'
- 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')
- def message(msg): #function for sending messages to the IRC chat
- global msgsend
- time.sleep( 2 )
- irc.send('PRIVMSG ' + channel + ' :'+msg+'\r\n')
- while True:
- data = irc.recv(1204) # gets output from IRC server
- user = data.split(':')[1]
- user = user.split('!')[0] # determines the sender of the messages
- print data ##ON/OFF
- if data != '':
- if data.find('PING') != -1:
- irc.send(data.replace('PING', 'PONG')) # responds to PINGS from the server
- print "Pong"
- if data.find(channel + ' :!death') != -1:
- if user in userarray:
- deaths = deaths + 1
- dirtmaul = "New death count: %d" % deaths
- message(dirtmaul) # Change to input/add !newmmr
- if data.find(channel + ' :!count') != -1:
- dirtmaul = "Current death count: %d" % deaths
- message(dirtmaul) # Change to input/add !newmmr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement