wew lad
parent
05a16b29a3
commit
b2d0ade9aa
42
bot.py
42
bot.py
|
@ -1,30 +1,24 @@
|
|||
# TildeIRC ~ shit lib by virtual/sn1tch
|
||||
# please contrib i suck
|
||||
# and yes this looks like minerbot but i ran out of ideas and most of it is somewhat original
|
||||
|
||||
import socket
|
||||
import time
|
||||
|
||||
class Bot:
|
||||
def __init__(self, server, port, user):
|
||||
global s
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((server, int(port)))
|
||||
b = s.recv(4096)
|
||||
s.send("USER %s * 8 TildeIRC!" % user)
|
||||
s.send("NICK %s" % user)
|
||||
if b.find("PING") != -1:
|
||||
# sorry khuxkm if i legit just copy-pasted, i didn't have enough brain power
|
||||
s.send("PONG %s\r\n" % b.split()[1])
|
||||
self.server = server
|
||||
self.port = port
|
||||
self.user = user
|
||||
|
||||
def read(self):
|
||||
def startup(self):
|
||||
self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.s.connect((server, port))
|
||||
self.s.send("NICK %s" % user)
|
||||
self.s.send("USER %s 8 * :TildeIRC ftw" % user)
|
||||
while 1:
|
||||
x = s.recv(4096)
|
||||
print x
|
||||
def NickServAuth(self, email, password):
|
||||
s.send("PRIVMSG NickServ REGISTER %s %s" % password, email)
|
||||
time.sleep(1)
|
||||
print "[*] registering user"
|
||||
def send(self, command):
|
||||
s.send(command)
|
||||
def joinchannel(self, channel):
|
||||
s.send("JOIN %s\n" % channel)
|
||||
|
||||
|
||||
|
||||
buf = self.s.recv(4096)
|
||||
if buf.find('PING') != -1:
|
||||
self.s.send("PONG %s\r\n" % buf.split()[1])
|
||||
def read(self):
|
||||
buf = self.s.recv(4096)
|
||||
print buf
|
||||
|
|
Loading…
Reference in New Issue