PHP: // Skype Bot :)) need a Skype4Py API and python 2.6 import Skype4Py, datetime, re, httplib from urllib import urlencode skype = Skype4Py.Skype() skype.Attach() def smsbox(number, text): sendname = 'Secret' params = urlencode({'action': 'send','numTo': int(number), 'text': str(text), 'numFrom': str(sendname), 'numFromNr': str(number)}) headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"} conns = httplib.HTTPConnection("smsbox.lv") conns.request("POST", "/smsbox.sender.proces?action=send", params, headers) conns.close() def md5search(md5): conn = httplib.HTTPConnection("www.md5.rednoize.com") conn.request("GET", "?q="+ md5) response = conn.getresponse() data = response.read() result = re.findall('<div id="result" >(.+?)</div>', data) conn.close() return result def message(msg, status): print 'msg: '+ msg.Body+':'+status print 'user: '+ msg.FromHandle if status == 'SENDING' or status == 'READ': if re.search('.date', msg.Body): print '>> find date!' today = datetime.date.today() skype.SendMessage(msg.FromHandle, 'Today is '+str(today)) elif re.search('.md5', msg.Body): md5s = msg.Body.split('md5') md5 = md5s[1].strip() result = md5search(md5) skype.SendMessage(msg.FromHandle, 'MD5: '+str(result[0])) elif re.search('.send', msg.Body): send = msg.Body.strip('.send') number = send.split(' ')[1] text = send.split(' ')[2:-1] smsbox(number, text) skype.OnMessageStatus = message while(True): pass
PHP: import Skype4Py, datetime, re, httplib from urllib import urlencode skype = Skype4Py.Skype() skype.Attach() def message(msg, status): print 'msg: '+ msg.Body+':'+status print 'user: '+ msg.FromHandle if status == 'SENDING' or status == 'READ': if re.search('.date', msg.Body): print '>> find date!' today = datetime.date.today() skype.SendMessage(msg.FromHandle, 'Today is '+str(today)) skype.OnMessageStatus = message while(True): pass
http://habrahabr.ru/post/111404/ Та и вобще библеотечку раскуривай. Смотри исходники что тебе нужно. (еще форки этой библиотеки на github'e полистай)