Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #responds to .np with currently playing song
- def hook_OnPrivmsg_nowplaying(thread, event, user, target, message):
- if message == '.np':
- if target[0] != '#':
- # if it's not sent to channel, reply to user
- target = thread.user(user).nick
- h = httplib.HTTPConnection('eden')
- h.request('GET','/wordpress/np.php')
- hr = h.getresponse()
- if hr.status != 200:
- thread.send('PRIVMSG %s :Error retrieving now playing information.' % target)
- return True
- e = xml.etree.ElementTree.XML(hr.read())
- listeners = e.find('listeners').text
- current = _striphtml(e.find('current').text)
- thread.send('PRIVMSG %s :4Listeners: %s, 4Now Playing: %s' % (target, listeners, current))
- return True
Add Comment
Please, Sign In to add comment