Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chanQueue = [] ; channels = []
- users = {
- "Aha2Y!DutchFag": "admin"
- }
- s = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
- s.connect ( ( host, port) )
- s.send ( 'NICK %s\r\n' % botnick)
- s.send ( 'USER znc bot znc :znc\r\n')
- while True:
- data = s.recv ( 4096 )
- raw = data.split()
- print data
- nick = data.split('!')[0][1:]
- sender = data.split('@')[0][1:]
- if data.find ( 'PING' ) != -1:
- s.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
- if data.find ( 'You need to send your password. Try /quote PASS <username>:<password>' ) != -1:
- s.send ('PASS %s \r\n' % zncauth)
- if data.split()[1] == 'JOIN':
- channels.append(data.split()[2][:1])
- if data.find ( '!uptime' ) != -1:
- chanQueue.append(data.split()[2])
- s.send('PRIVMSG *STATUS :uptime\r\n')
- if data.find ( 'status!znc@znc.in PRIVMSG %s :Running for' % botnick) != -1:
- channel = chanQueue[0]; del chanQueue[0]
- days = raw[5].lstrip('d')
- hours = raw[6]
- minuts = raw[7]
- seconds = raw[8]
- s.send('PRIVMSG %s :The bouncer is up for %s %s %s %s!\r\n' % (channel, days, hours, minuts, seconds))
- if data.find ( '!global' ) != -1:
- try:
- if users[str(sender)]:
- if len(raw) != 4:
- chanQueue.append(data.split()[2])
- globalmessage = raw[4:]
- message = ' '.join(globalmessage)
- s.send('PRIVMSG *status :broadcast [Global] %s\r\n' % message)
- except KeyError:
- s.send('notice %s :You are not a admin.\r\n' % nick)
- if data.find ( '!rehash' ) != -1:
- try:
- if users[str(sender)]:
- if len(raw) == 4:
- s.send('PRIVMSG *STATUS :rehash\r\n')
- s.send('PRIVMSG %s :Rehashed the bouncer.\r\n' % raw[2])
- except KeyError:
- s.send('notice %s :You are not a admin.\r\n' % nick)
- if data.find ( '!help' ) != -1:
- if len(raw) == 4:
- s.send('PRIVMSG %s :Available public commands: !uptime\n' % raw[2])
- s.send('PRIVMSG %s :Available admin commands: !global, !rehash\n' % raw[2])
- if data.find ( '!test' ) != -1:
- if len(raw) == 4:
- s.send('PRIVMSG %s :%s\n' % (channel, sender))
- if data.find ( ':*** [Global]' ) != -1:
- globalmessage = raw[4:]
- channel = chanQueue[0]; del chanQueue[0]
- message = ' '.join(globalmessage)
- s.send('PRIVMSG %s :%s\r\n' % (channels, message))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement