Skip to content

Instantly share code, notes, and snippets.

@kroovysteph
Created November 26, 2016 08:39
Show Gist options
  • Save kroovysteph/d008d200d3b88a7903ecfd10fc8496cc to your computer and use it in GitHub Desktop.
Save kroovysteph/d008d200d3b88a7903ecfd10fc8496cc to your computer and use it in GitHub Desktop.
import sys
import time
import socket
server = "irc.hackint.org" #settings
channel = "#jimileibniz"
botnick = "groovebot"
#establish connection
irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
irc.connect((server,6667))
irc.setblocking(False)
time.sleep(1)
irc.send("USER "+botnick+" "+botnick+" "+botnick+" :Bam!\r\n")
time.sleep(1)
irc.send("NICK "+botnick+"\r\n")
time.sleep(1)
irc.send("JOIN "+channel+"\r\n")
all_users = "Hey edwarf, floridori, kroovy, Anco, busti, johnnyb, lagertonne, lenniwings, master206, re2one, schokobaer!"
while 1:
time.sleep(0.1)
try:
text=irc.recv(2040)
print(text)
except Exception:
pass
if text.find("PING")!=-1:
irc.send("PONG "+text.split()[1]+"\r\n")
if text.lower().find(":@hi")!=-1:
irc.send("PRIVMSG "+channel+" :Hello!\r\n")
if text.lower().find(":@join")!=-1:
irc.send("JOIN #jimileibniz\r\n")
if text.lower().find(":@all")!=-1:
irc.send("PRIVMSG "+channel+" :"+all_users+"\r\n")
text=""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment