Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: UTF-8 -*-
- from twisted.words.protocols import irc
- from twisted.internet import reactor, protocol
- from twisted.python import log
- from twisted.python.util import InsensitiveDict as IDict
- import re, random, time
- class ircclient(irc.IRCClient):
- #Nick
- nickname = "cj"
- #Real name
- realname = "Carl Johnson"
- #Username
- username = "carl"
- ##Nickserv password
- #password = "NONE"
- #CTCP VERSION reply
- versionName = "GSF"
- def signedOn(self):
- self.join(self.factory.channel)
- def privmsg(self, user, channel, msg):
- user = user.split('!', 1)[0]
- if msg.startswith('!ascii '):
- ascii = msg.split()
- text = open('/home/anthony/a/%s.txt' % ascii[1], 'r')
- for line in text:
- line = line[0:len(line)-1]
- self.msg(channel, line)
- elif msg.startswith('!wavy '):
- incrementing = True
- x = 0
- ascii = msg.split()
- text = open('/home/anthony/a/%s.txt' % ascii[1], 'r')
- for line in text:
- self.msg(channel, ' '*x + line)
- if incrementing:
- x+=1
- if x == 10:
- incrementing = False
- else:
- x-=1
- if x == 0:
- incrementing = True
- elif msg.startswith('!color '):
- ascii = msg.split()
- derp = ''
- derp = str(random.randint(0,9))
- text = open('/home/anthony/a/%s.txt' % ascii[1], 'r')
- for line in text:
- line = line.replace(ascii[2], derp)
- self.msg(channel, line)
- elif msg.startswith('!sex'):
- self.msg(channel, 'NO THATS GROSS')
- if msg.startswith('!fb'):
- x = 0
- for user in range(6):
- self.msg(channel, 'hey ' + user)
- x+=1
- class ircprotocol(protocol.ClientFactory):
- protocol = ircclient
- def __init__(self, channel):
- self.channel = channel
- def clientConnectionLost(self, connector, reason):
- connector.connect()
- def clientConnectionFailed(self, connector, reason):
- print "connection failed:", reason
- reactor.start()
- if __name__ == '__main__':
- f = dittoprotocol("#grove")
- reactor.connectTCP("irc.gorf.us", 6667, f)
- reactor.run()
Add Comment
Please, Sign In to add comment