Top

IRC Bot


Python Code
+ 1 likes
Please Register to submit score.
Bookmark and Share
Average Score  4.0 (of 1 scores)
Date Added  Mar 21, 2007
Last Updated  Dec 11, 2008
Tags  bot  irc  python 

Introduction

you can run it on Windows by downloading http://www.python.org/ftp/python/2.5/python-2.5.msi install that

when you want to edit it, right click on the file and hit Edit with IDLE

if you want to run it just double click on it.

It simply makes the bot join the server in this case, irc.snm.co.nz it then joins #paul, when its join privmsg's #paul and yeah

Grab the Code

import socket
 
network = 'irc.snm.co.nz'
port = 6667
irc = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
irc.connect ( ( network, port ) )
print irc.recv ( 4096 )
irc.send ( 'NICK botty\r\n' )
irc.send ( 'USER botty botty botty :Python IRC\r\n' )
irc.send ( 'JOIN #paul\r\n' )
irc.send ( 'PRIVMSG #Paul :Hello World.\r\n' )
while True:
   data = irc.recv ( 4096 )
   if data.find ( 'PING' ) != -1:
      irc.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
   if data.find ( '!botty quit' ) != -1:
      irc.send ( 'PRIVMSG #paul :Fine, if you don't want me\r\n' )
      irc.send ( 'QUIT\r\n' )
   if data.find ( 'hi botty' ) != -1:
      irc.send ( 'PRIVMSG #paul :I already said hi...\r\n' )
   if data.find ( 'hello botty' ) != -1:
      irc.send ( 'PRIVMSG #paul :I already said hi...\r\n' )
   if data.find ( 'KICK' ) != -1:
      irc.send ( 'JOIN #paul\r\n' )
   if data.find ( 'cheese' ) != -1:
      irc.send ( 'PRIVMSG #paul :WHERE!!!!!!\r\n' )
   if data.find ( 'slaps botty' ) != -1:
      irc.send ( 'PRIVMSG #paul :This is the Trout Protection Agency. Please put the Trout Down and walk away with your hands in the air.\r\n' )
   print data

Comments

  (23)  RSS
Hawkee
Comments: 1,039
 
Python Snippet:  IRC Bot
Posted on Mar 21, 2007 4:35 am
Please describe what it does in your Introduction.
Cazz
Comments: 40
 
Python Snippet:  IRC Bot
Posted on Sep 22, 2007 5:56 pm
I don't understand what this is for...
ScoopSiteAddict
Comments: 4
 
Python Snippet:  IRC Bot
Posted on Feb 16, 2008 10:31 pm
Yep pls Describe what it does in your introduction..... :P
Viper01
Comments: 94
 
Python Snippet:  IRC Bot
Posted on May 6, 2008 3:35 pm
from what i gather its a Python-coded irc bot .-.
AdrianF
Comments: 53
 
Python Snippet:  IRC Bot
Posted on Jun 6, 2008 4:47 am
How The Hell Do I Run This SCript In Python?
AdrianF
Comments: 53
 
Python Snippet:  IRC Bot
Posted on Jun 6, 2008 4:47 am
i edited it so it would go on my server. BUT how do i run it?
F*U*R*B*Y*
Comments: 637
 
Python Snippet:  IRC Bot
Posted on Jun 6, 2008 5:02 am
double click the file.........
AdrianF
Comments: 53
 
Python Snippet:  IRC Bot
Posted on Jun 6, 2008 5:50 am
I Did. Like What Type Of File It Gotta be? I Double click it. nthin happens
wer i putit? help!!!
F*U*R*B*Y*
Comments: 637
 
Python Snippet:  IRC Bot
Posted on Jun 6, 2008 7:33 am
filename.py
AdrianF
Comments: 53
 
Python Snippet:  IRC Bot
Posted on Jun 6, 2008 8:25 am
i did. nothin happened
F*U*R*B*Y*
Comments: 637
 
Python Snippet:  IRC Bot
Posted on Jun 6, 2008 8:59 am
*shrugs* works for me.......
AdrianF
Comments: 53
 
Python Snippet:  IRC Bot
Posted on Jun 6, 2008 10:37 am
Can You Add Me Too MSN And Help?
snooopylove@hotmail.com
Monie
Comments: 1
 
Python Snippet:  IRC Bot
Posted on Dec 7, 2008 1:59 pm
Did it remove the \r\n\ before or is that how it is suppose to be in python?
Hawkee
Comments: 1,039
 
Python Snippet:  IRC Bot
Posted on Dec 7, 2008 5:10 pm
The \r\n was likely removed inadvertently. This was posted when we had a bug in our system that resulted in the loss of the \'s. This has been corrected now, but the snippet needs to be updated.
F*U*R*B*Y*
Comments: 637
 
Python Snippet:  IRC Bot
Posted on Dec 11, 2008 12:17 am
edited to fix the rn to \r\n problem. :)
PATX
Comments: 390
 
Python Snippet:  IRC Bot
Posted on Mar 16, 2009 3:42 pm
its works fine.gets a 9
bone282
Comments: 31
 
Python Snippet:  IRC Bot
Posted on Mar 16, 2009 3:57 pm
Quote:

if you want to run it just double click on it.

not everyone has computer set to execute on double click. 90% or more have it set to open the file on double click
PATX
Comments: 390
 
Python Snippet:  IRC Bot
Posted on Mar 16, 2009 4:05 pm
then right click and select open or run
PATX
Comments: 390
 
Python Snippet:  IRC Bot
Posted on Apr 26, 2009 6:43 pm
suggestions: dont use raw protical. i recommend circuits or irclib. raw protical times out etc...

helpful links:
http://trac.softcircuit.com.au/circuits
http://python-irclib.sourceforge.net/
Cazz
Comments: 40
 
Python Snippet:  IRC Bot
Posted on Jul 21, 2009 10:33 pm
Hmm...python looks mighty easier than PHP :P
PATX
Comments: 390
 
Python Snippet:  IRC Bot
Posted on Jul 22, 2009 5:10 pm
it is Cazz! its also faster and more useful. u should learn it! it makes programing and devel sooooo much easier!
GlobalAnomaly
Comments: 77
 
Python Snippet:  IRC Bot
Posted on Sep 5, 2009 1:45 am
Oh nice. Helps me understand some concepts used in Python for IRC-based things.
Vesperia
Comments: 26
 
Python Snippet:  IRC Bot
Posted on Oct 10, 2009 8:20 pm
This makes no sense to me whatsoever. How am I supposed to use it. And why have us download something from another website?

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom