Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __author__ = 'legacy'
- import socket
- import string
- import re
- # Enter nickname and realname, so the server can identify you
- nickname = "Archangelv2"
- realname = "Archangelv2"
- host = "irc.speedhell.com"
- port = 6667
- target_channel = "#testbotchan"
- readbuffer = ""
- socket = socket.socket()
- socket.connect((host, port))
- socket.send("NICK %s\r\n" % nickname)
- socket.send("USER %s 0 * : %s\r\n" % (nickname, realname))
- while 1:
- readbuffer = readbuffer + socket.recv(1024)
- temp = string.split(readbuffer, "\n")
- readbuffer = temp.pop( )
- for line in temp:
- print line
- # Check if this is an announce, test will be a value if it is
- # Regex parser
- sender = ""
- message = ""
- new_message = ""
- bot = ""
- PM = ""
- new_test = ""
- second_sender = ""
- test = re.search(":(.*)!.*(A.*)\s:(.*)", line)
- if test:
- sender = test.group(1)
- bot = test.group(2)
- message = test.group(3)
- # This will reply back to the server if it sends out a PING
- line = line.split(" ")
- if line[0] == "PING" :
- socket.send("PONG %s\r\n" % line[1])
- if line[1] == "001":
- socket.send("JOIN %s\r\n" % target_channel)
- if message.startswith("!plex"):
- socket.send("PRIVMSG %s :%s: To activate plex please use this tutorial: https://speedhell.com/forums/viewtopic.php?f=1&t=4\r\n" % (target_channel, sender))
- elif message.startswith("!sickrage"):
- socket.send("PRIVMSG %s :%s: To install SickRage please use this tutorial: https://speedhell.com/forums/viewtopic.php?f=1&t=6\r\n" % (target_channel, sender))
- if sender == "Global":
- if bot == "Archangelv2":
- new_test = re.search(":(.*)!.*(A.*)\s:(.*)", line)
- second_sender = new_test.group(1)
- PM = new_test.group(3)
- socket.send("PRIVMSG %s :%s" % (second_sender, PM))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement