Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import socket
- import string
- import random
- import time
- import math
- HOST="irc.root-me.org"
- PORT=6667
- CHAT_MATE="Candy"
- NICK="pendekar_langit_bot"
- IDENT="pendekar_langit_bot"
- REALNAME="pendekar_langit_bot"
- JOIN="#root-me_challenge"
- readbuffer=""
- challenge = ""
- s=socket.socket( )
- s.connect((HOST, PORT))
- time.sleep(3)
- s.send("NICK %s\r\n" % NICK)
- time.sleep(3)
- s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
- time.sleep(3)
- s.send("JOIN %s\r\n" % JOIN)
- # time.sleep(3)
- # s.send("PRIVMSG %s :testing my bot" % JOIN)
- time.sleep(3)
- s.send("PRIVMSG %s :%s\r\n" % (CHAT_MATE, "!ep1"))
- time.sleep(1)
- while 1:
- readbuffer=readbuffer+s.recv(1024)
- temp=string.split(readbuffer, "\n")
- print temp
- readbuffer=temp.pop( )
- for line in temp:
- line=string.rstrip(line)
- line=string.split(line)
- print line
- message = line[len(line)-3]+line[len(line)-2]+line[len(line)-1]
- if(message[:1] == ":"):
- message = message[1:]
- client = line[0]
- if(client[:1] == ":"):
- client = client[1:]
- client = client.split("!")
- client = client[0]
- print client
- print message
- if(client == CHAT_MATE):
- var_1 = message.split("/")[0]
- var_2 = message.split("/")[1]
- hasil = math.pow(float(var_1), 1) * math.pow(float(var_2), 2)
- print "PRIVMSG %s :%s\r\n" % (client, int(hasil))
- s.send("PRIVMSG %s :!ep1 -rep %s\r\n" % (client, int(hasil)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement