diff options
| author | eroen | 2013-07-24 01:11:57 +0200 |
|---|---|---|
| committer | eroen | 2013-07-24 01:11:57 +0200 |
| commit | 55c218020baebaa4230bfdad9a488bfe496361d7 (patch) | |
| tree | d4adc2af87b6c60a1f9f9f4a96985489e1f52ace /ircbot.py | |
| download | echoboom-fuse-55c218020baebaa4230bfdad9a488bfe496361d7.tar.gz echoboom-fuse-55c218020baebaa4230bfdad9a488bfe496361d7.tar.bz2 echoboom-fuse-55c218020baebaa4230bfdad9a488bfe496361d7.tar.xz | |
Diffstat (limited to 'ircbot.py')
| -rwxr-xr-x | ircbot.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ircbot.py b/ircbot.py new file mode 100755 index 0000000..701efec --- /dev/null +++ b/ircbot.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python2.7 +import socket + +def main(): + network = 'chat.freenode.org' + port = 6667 + irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + irc.connect((network, port)) + print irc.recv(4096) + mychan = '#echoboom' + irc.send('NICK echoboom-fuse-bot1\r\n') + irc.send('USER botty botty botty :Python IRC\r\n') + irc.send('JOIN ' + mychan + '\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 ' + mychan + ' :Fine, if you don''t want me\r\n') + irc.send('QUIT\r\n') + if data.find('hi botty') != -1: + irc.send('PRIVMSG ' + mychan + ' :I already said hi...\r\n') + if data.find('hello botty') != -1: + irc.send('PRIVMSG ' + mychan + ' :I already said hi...\r\n') + if data.find('KICK') != -1: + irc.send('JOIN ' + mychan + '\r\n') + if data.find('cheese') != -1: + irc.send('PRIVMSG ' + mychan + ' :WHERE!!!!!!\r\n') + if data.find('slaps botty') != -1: + irc.send('PRIVMSG ' + mychan + ' :This is the Trout Protection Agency. Please put the Trout Down and walk away with your hands in the air.\r\n') + print data + +main() |
