Advertisement
rey444xd3

Untitled

Aug 31st, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. import hexchat
  2. import threading
  3. import urllib2
  4. import re
  5.  
  6.  
  7. __module_name__ = 'isSilenced'
  8. __module_author__ = 'Rey'
  9. __module_version__ = '1'
  10. __module_description__ = 'Check if user is silenced on osu'
  11.  
  12. def check(word):
  13. req = urllib2.Request('https://osu.ppy.sh/u/%s' % word[1])
  14. response = urllib2.urlopen(req)
  15. the_page = response.read()
  16. xaxa = re.compile(r">(.*)can\'t\sspeak\sfor\sanother\s(.*)\.<")
  17. x = xaxa.search(the_page)
  18. if x is None:
  19. hexchat.prnt("%s is not silenced." % word[1])
  20. else:
  21. hexchat.prnt("%s is silenced for %s" % (x.groups()[0], x.groups()[1]))
  22.  
  23. def _cb(word, word_eol, userdata):
  24. if len(word) < 2:
  25. hexchat.prnt("Nick not supplied")
  26. else:
  27. t = threading.Thread(target=check, args=(word,))
  28. t.start()
  29.  
  30. def unload_cb(userdata):
  31. print(__module_name__+' version '+__module_version__+' unloaded.')
  32.  
  33. hexchat.hook_command('isS', _cb)
  34. hexchat.hook_unload(unload_cb)
  35. hexchat.prnt(__module_name__+' version '+__module_version__+' loaded.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement