SHARE
TWEET

Untitled

a guest May 19th, 2017 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # This is the main file program
  2. #!/usr/bin/python
  3. import socket
  4. import irc
  5.  
  6. b00tii = irc.IRC_functions()
  7.  
  8. while True:
  9.     b00tii.getfeedback()
  10.     b00tii.pingpong()
  11.     print b00tii._feedback
  12. #This is the file with the functions, the irc module
  13. from socket import socket
  14. class IRC_functions():
  15.     def __init__(self):
  16.         self.s.connect((self._server,self._port))
  17.         self.nick()
  18.         self.user
  19.         self._feedback = self.s.recv(4096)
  20.     s=socket()
  21.     _feedback=""
  22.     _nick ="b00tii"
  23.     _server ="irc.ninthbit.net"
  24.     _port = 6667
  25.     def getfeedback(self):
  26.         self.feedback = self.s.recv(4096)
  27.  
  28.     def nick(self, nick = _nick):
  29.         self.s.send("NICK " + nick)
  30.  
  31.     def user(self, nick = _nick):
  32.         self.s.send("USER " + nick + "* * : " + nick)
  33.  
  34.     def pingpong(self):
  35.         if self._feedback.find ( 'PING' ) != -1:
  36.             s.send( 'PONG ' + data.split() [ 1 ] + '\r\n' )
  37.  
  38.     def join(self, channel):
  39.         self.s.send("JOIN " + channel)
  40.  
  41.     def part(self, channel, message=""):
  42.         self.s.send("PART "+ channel + " " + message)
  43.  
  44.     def message(self, channel, message):
  45.         self.s.send("PRIVMSG " + channel + " :" + message)
  46.  
  47.     def ctcp(self, user, message):
  48.         self.s.message(user, "\001" + message + "\001")
  49.  
  50.     def action(self, channel, message):
  51.         self.ctcp(channel, "ACTION" + message)
  52.  
  53.     def mode(self, channel, mode, flags=""):
  54.         self.s.send("MODE " + channel + mode + " " + flags)
  55.  
  56.     def kick(self, channel, reason=""):
  57.         self.s.send("KICK" + channel + " " + reason)
  58.     def read_msg(self, origin):
  59.         nick, parts = origin.split('!', 2)
  60.         ident, parts = parts.split('@', 2)
  61.         host, message = parts.split(':',2)
  62.         return [nick, ident, host]
RAW Paste Data
Top