Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from IRC import *
- import time
- import random
- import sys
- ### Server Options
- SERVER = "irc.chat.twitch.tv" # server
- PORT = 6667 # port
- ### User/Channel Options
- PASS = "oauth:x725aqacblofgd73xlrdgwpo2xn874" # plum0_ bot password
- BOT = "plum0_" # Bot's name no caps
- CHANNEL = "plum0_" # Channel name no caps
- OWNER = "plum0_" # Owner's name no caps
- bot = IRC(SERVER, PORT, PASS, BOT, CHANNEL, OWNER)
- bot.joinchat()
- ##bot.s.send(("CAP REQ :twitch.tv/membership\r\n").encode())
- ##bot.s.send(("CAP REQ :twitch.tv/tags\r\n").encode())
- ##bot.s.send(("CAP REQ :twitch.tv/commands\r\n").encode())
- while True:
- try:
- readbuffer = bot.s.recv(1024)
- readbuffer = readbuffer.decode('utf-8')
- temp = readbuffer.split("\n")
- readbuffer = readbuffer.encode('utf-8')
- readbuffer = temp.pop()
- except:
- temp = ""
- for line in temp:
- if line == "":
- break
- ### So twitch doesn't timeout the bot.
- if "PING" in line and bot.Console(line):
- msgg = "PONG tmi.twitch.tv\r\n".encode()
- bot.s.send(msgg)
- print(msgg)
- break
- ### get user
- user = bot.getUser(line)
- ### get message send by user
- message = bot.getMessage(line)
- ### for you to see the chat from CMD and prevents some spammy text
- if "tmi.twitch.tv NOTICE #" in user and "Your color has been changed." in message or ".twitch.tv USERSTATE #" in user:
- break
- else:
- print(user + " > " + message)
- ### sends private msg to the user (start line)
- PMSG = "/w " + user + " "
- if bot.coolCheck():
- if "plum" in message.lower():
- bot.sendMessage(bot.s, "")
- def quote(user,message):
- file = open("Tzu.txt")
- #num_lines = sum(1 for line in open("Tzu.txt"))
- lines = file.read().splitlines()
- time.sleep(1)
- ater = user
- try:
- if(len(message.lower()[5:])!=0):
- ater = message.lower()[5:]
- sendMessage(s, random.choice(lines) + " @" + ater)
- else:
- sendMessage(s, random.choice(lines) + " @" + user)
- except:
- print(user + " tried to break the bot.")
- sendMessage(s, random.choice(lines) + " @" + user)
- file.close()
- bot.cooldown(2) # CoolDown Time
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement