Team BlueWater Game Online Tutorial's
Bine ati venit la Team-BlueWater!!Tutorial's 4 all Games!

[Sursa] Python Skype Bot

View previous topic View next topic Go down

[Sursa] Python Skype Bot

Post  Karma on Sun Jul 31, 2011 7:44 am

Code:
// 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("[You must be registered and logged in to see this link.]
    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
avatar
Karma
Admin
Admin

Mesaje : 1092
Data de inscriere : 2011-04-22
Varsta : 26
Localizare : Craiova

View user profile http://team-bluewater.forumz.ro

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum