Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import random
- import time
- import re
- import string
- import traceback
- server = ('irc.orderofthetilde.net', 6667)
- username = "gamebot"
- #+ str(random.randrange(1,69))
- hoppy = '#Battlearena'
- s = socket.socket()
- s.connect(server)
- s.send('NICK '+ username + '\r\n')
- s.send('USER ' + username + ' . . :retard\r\n')
- possible_monsters = ['Bee','BluePoring','Poring','Lost_Soul', 'orb_fountain','Wild_Rabbit','Jester', 'Ding_bats', 'Brauner', 'Tiamat']
- readbuffer = ""
- monsters = []
- while 1:
- readbuffer = s.recv(2048)
- lines = readbuffer.split('\n')
- for line in lines:
- line = line.rstrip()
- print 'this is feed' + feed
- terms = feed.split()
- if not terms: continue
- print terms
- # put comamnds and checks after this comment. Everything above this is all that is needed.
- try:
- if len(terms) >= 0 and terms[0] == 'PING':
- s.send('PONG '+terms[1]+'\r\n')
- elif len(terms) >= 1 and '376' == terms[1]:
- s.send('JOIN ' + hoppy +'\r\n')
- s.send('PRIVMSG ' + hoppy + ' !id 54321' + '\r\n')
- if len(terms) >= 3 and ':!test' == terms[3]:
- s.send('PRIVMSG ' + hoppy + ' test' + '\r\n')
- elif len(terms) > 4 and 'dimensional'== terms[4]:
- s.send('PRIVMSG ' + hoppy + ' !enter' + '\r\n')
- elif len(terms) >= 3 and ':!printmonsters' == terms[3]:
- s.send('PRIVMSG ' + hoppy + ' the monsters are ' + str(monsters) + '\r\n')
- s.send('PRIVMSG ' + hoppy + ' hello ' + str(possible_monsters) + '\r\n')
- print 'the cmd is working'
- except:
- print traceback.print_exc()
- try:
- if len(terms) > 4 and 'order' == terms[4]:
- for term in terms:
- if term in possible_monsters:
- monsters.append(term)
- print monsters
- if monsters >= 1:
- num = 0
- if monsters > 1:
- num = random.randint(0,len(monsters))
- if len(terms) > 4 and ':gamebot' == terms[3] and 'steps' == terms[4]:
- s.send('PRIVMSG ' + hoppy + ' !attack ' + str(monsters[num]) + '\r\n')
- if len(terms) > 5 and "gamebot" == terms[3] and terms[5]== 'another':
- s.send('PRIVMSG ' + hoppy + ' !attack ' + str(monsters[num]) + '\r\n')
- if len(terms) > 5 and "gamebot's" == terms[5]:
- s.send('PRIVMSG ' + hoppy + ' !attack ' + str(monsters[num]) + '\r\n')
- if len(terms) > 5 and 'their' == terms[4] and 'victory' == terms[5]:
- del monsters[:]
- if len(terms) > 5 and 'their' == terms[4] and 'efforts' == terms[5]:
- del monsters[:]
- except:
- print traceback.print_exc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement