IRC bot (oude kanaal)

From VoidWarranties - Hackerspace Antwerp, Belgium
Revision as of 17:35, 28 December 2014 by Warddr (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


IRC bot (oude kanaal)
What:
A bot that runs on our old, abandoned, channel
Event.png
Participants:
warddr
Category:
Coding
Locations:
irc

this is a very simpel bot that tells everyone who moved that we moved our IRC channel:

source code

import socket
 
network = 'irc.freenode.net'
port = 6667
irc = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
irc.connect ( ( network, port ) )
print irc.recv ( 4096 )
irc.send ( 'NICK Voidbotty\r\n' )
irc.send ( 'USER botty botty botty :Python IRC\r\n' )
irc.send ( 'JOIN #hackerspace-voidwarranties\r\n' )
irc.send ( 'PRIVMSG #hackerspace-voidwarranties :Hello World.\r\n' )
while True:
   data = irc.recv ( 4096 )
   if data.find ("JOIN") != -1:
      nick = data[1:]
      nick = data.split("!")[0]
      irc.send ( 'PRIVMSG #hackerspace-voidwarranties ' + nick + ', we moved to #voidwarranties\r\n' )
   print data
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Content Creation
Belgian Spaces