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 random
- import urllib2
- import datetime
- import sys
- from random import randint
- phrases = [
- "MitchPls THIS MitchPls SONG MitchPls IS MitchPls ILL MitchPls NASTY MitchPls THIS MitchPls SONG MitchPls IS MitchPls ILL MitchPls NASTY MitchPls THIS MitchPls SONG MitchPls IS MitchPls ILL MitchPls NASTY MitchPls",
- "SourPls THIS SourPls SONG SourPls IS SourPls ILL SourPls NASTY SourPls THIS SourPls SONG SourPls IS SourPls ILL SourPls NASTY SourPls THIS SourPls SONG SourPls IS SourPls ILL SourPls NASTY SourPls",
- "bUrself I bUrself Dream bUrself Of bUrself A bUrself Chat bUrself Full bUrself Of bUrself Bees bUrself",
- "OpieOP I EAT BURGERS ALL DAY OpieOP LEAGUE OF LEGENDS I CANNOT PLAY OpieOP KOREANS I HAVE TO PAY OpieOP YOU GUESSED IT RIGHT OpieOP IM FROM NA OpieOP",
- "EleGiggle MY BELLY IS HUGE EleGiggle MY BRAIN HAS DELAY EleGiggle YOU GUESSED IT RIGHT EleGiggle I'M FROM NA"
- ]
- sound_commands = [
- "!mlg",
- "!gg",
- "!unstoppable",
- "!lol",
- "!victory",
- "!sad",
- ]
- #sets variables for connection to twitch chat
- bot_owner = 'Gasolinebased'
- nick = sys.argv[1]
- #nick = 'fwnaeuifbweoyi'
- channel = '#atomicus'
- server = 'irc.twitch.tv'
- password = sys.argv[2]
- #password = 'oauth:891j6yyz3nqg38afw1alxrn58eba07'
- def send_message(msg):
- irc.send("PRIVMSG " + channel + " :" + msg + "\n")
- sound_command_timer = int(round(time.time() * 1000))
- irc = socket.socket()
- is_spamming = -1
- spam_time = 0
- 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')
- f = open(channel + ".txt",'w')
- f.write("\n")
- f.write("Connected to " + channel + " starting log...\n")
- f.write("---------\n")
- while True:
- data = irc.recv(1204) #gets output from IRC server
- message = data.split(':')[1]
- user = message.split('!')[0] #determines the sender of the messages
- try:
- message = data.split(":")[2]
- except IndexError:
- message = data
- print datetime.datetime.now().strftime("%H:%M:%S") + " > " + user + ": " + message
- currentTime = int(round(time.time() * 1000))
- f.write(datetime.datetime.now().strftime("%H:%M:%S") + " > " + user + ": " + message)
- if user.find("atomicbots") != -1:
- send_message("MrDestructoid STFU ATOMICBOTS MrDestructoid")
- if message.find('!status') != -1:
- send_message("MrDestructoid READY TO DEMOLISH ATOMICBOTS MrDestructoid")
- if message.find('!autism') != -1:
- randLevel = randint(0,100)
- emote = ""
- if randLevel <= 30:
- emote = "FeelsGoodMan"
- else:
- emote = "FeelsBadMan"
- send_message(user + " is " + str(randLevel) + "%" + " autistic " + emote)
- if message.find("!farm") != -1:
- send_message("!datapad")
- if message.find("!sound") != -1:
- if int(round(time.time() * 1000)) - sound_command_timer > 10000:
- send_message(random.choice(sound_commands))
- else:
- send_message(user + " sounds are on a 10 second cooldown so my master won't get IP banned MrDestructoid")
- if message.find("!spam") != -1:
- if is_spamming == -1:
- send_message("FeelsGoodMan Spam status has been toggled: ON FeelsGoodMan")
- else:
- send_message("FeelsBadMan Spam status has been toggled: OFF FeelsBadMan")
- is_spamming = is_spamming * -1
- spam_time = int(round(time.time() * 1000))
- if currentTime - spam_time > 60000 * 3 and is_spamming == 1: #to prevet removal from double messaging within 30 sec
- spam_time = currentTime
- send_message(random.choice(phrases))
Add Comment
Please, Sign In to add comment