Skip to content

Instantly share code, notes, and snippets.

@alexfornuto
Forked from illblew/gist:8884b405bd5d90db4d4d
Last active August 29, 2015 14:06
Show Gist options
  • Save alexfornuto/12dcc0c161c1ba78792b to your computer and use it in GitHub Desktop.
Save alexfornuto/12dcc0c161c1ba78792b to your computer and use it in GitHub Desktop.
Might be something someday
#!/usr/bin/python
import socket
import sys
import mysqldb
server = "irc.swiftirc.net" #settings
channel = "#pxlbin"
botnick = "pxlboat"
#db jazzy
db=_mysql.connect("pxlb.in", "username", "password123", "database")
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
print "Connecting to:"+server
irc.connect((server, 6667))
irc.send("USER "+ botnick +" "+ botnick +" "+ botnick +" :Pxlbot loaded\n")
irc.send("NICK "+ botnick +"\n")
irc.send("PRIVMSG nickserv :iNOOPE\r\n")
irc.send("JOIN "+ channel +"\n")
irc.send("PRIVMG frienz :I've joined pxlbin.") #who to alert when the bot is running.
while 1: #infinite loop
text=irc.recv(2040)
print text #prints all text from irc network.
if text.find('PING') != -1:
irc.send('PONG ' + text.split() [1] + '\r\n') #REQIRED PING PONG
if text.lower.find('!getpxl') != -1: #This is the thing you'll be looking for!
irc.send("PRIVMSG wblew :hi\r\n") #This is how you take action when you see the thing you're lookign for
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment