Here is my trouble: It loads the IRC information fine, but when its suppose to Identify itself (its a registered nick I'm making it use)but, It doesn't.
So basically when after it connects, i want it to type that.
Here is my code:
## An IRC bot by: Fellixombc
import sys
import socket
import string
import os
HOST='asriel.moparisthebest.com'
PORT=6667
NICK='Fellix_Bot'
PASSWORD='password'
IDENT='BOT'
REALNAME='Tom The Bot'
OWNER='Fellixombc'
CHANNELINIT='#moparscape'
readbuffer=''
s=socket.socket( ) #Create the socket
s.connect((HOST, PORT)) #connects to irc/mopar
s.send('NICK ' + NICK + '\r\n')
s.send('USER ' + NICK + ' ' +NICK+ ' Test: ' + NICK + '\r\n')
s.send('/msg NickServ '+NICK+' '+PASSWORD+'n')
s.send('JOIN '+CHANNELINIT+'n') #join channel
s.send('HELLO NOOBS, and the sexy guy: '+OWNER+'n')
while 1:
line=s.recv(50) #recieve the server message, will help connect
print line #server message is output
if line.find('PRIVMSG')!=-1:
parsemsg(line)
line=line.rstrip()
line=line.split()
if(line[0]=='PING'):
s.send('PONG '+line[1]+'n')
def parsemsg(msg):
complete=msg[1:].split(':',1) #parse the message into useful data
info=complete[0].split(' ')
msgpart=complete[1]
sender=info[0].split('!')
if msgpart[0]=='!' and sender[0]==OWNER: #responds to me only, and will handle command if ! infront of it
cmd=msgpart[1:].split(' ')
if cmd[0]=='op':
s.send('MODE '+info[2]+' +o '+cmd[1]+'n')
if cmd[0]=='deop':
s.send('MODE '+info[2]+' -o '+cmd[1]+'n')
if cmd[0]=='voice':
s.send('MODE '+info[2]+' +v '+cmd[1]+'n')
if cmd[0]=='devoice':
s.send('MODE '+info[2]+' -v '+cmd[1]+'n')
if cmd[0]=='sys':
syscmd(msgpart[1:],info[2])
if msgpart[0]=='-' and sender[0]==OWNER :
cmd=msgpart[1:]
s.send(cmd+'n')
print 'cmd='+cmd
def syscmd(commandline,channel):
cmd=commandline.replace('sys ','')
cmd=cmd.rstrip()
os.system(cmd+' >temp.txt')
a=open('temp.txt')
ot=a.read()
ot.replace('n','|')
a.close()
s.send('PRIVMSG '+channel+' :'+ot+'n')
return 0