Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hexchat
- import threading
- import urllib2
- import re
- __module_name__ = 'isSilenced'
- __module_author__ = 'Rey'
- __module_version__ = '1'
- __module_description__ = 'Check if user is silenced on osu'
- def check(word):
- req = urllib2.Request('https://osu.ppy.sh/u/%s' % word[1])
- response = urllib2.urlopen(req)
- the_page = response.read()
- xaxa = re.compile(r">(.*)can\'t\sspeak\sfor\sanother\s(.*)\.<")
- x = xaxa.search(the_page)
- if x is None:
- hexchat.prnt("%s is not silenced." % word[1])
- else:
- hexchat.prnt("%s is silenced for %s" % (x.groups()[0], x.groups()[1]))
- def _cb(word, word_eol, userdata):
- if len(word) < 2:
- hexchat.prnt("Nick not supplied")
- else:
- t = threading.Thread(target=check, args=(word,))
- t.start()
- def unload_cb(userdata):
- print(__module_name__+' version '+__module_version__+' unloaded.')
- hexchat.hook_command('isS', _cb)
- hexchat.hook_unload(unload_cb)
- hexchat.prnt(__module_name__+' version '+__module_version__+' loaded.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement