Skype Bot

By armagidon on Mar 27, 2010

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

Comments

Sign in to comment.
armagidon   -  Mar 27, 2010

thanks.. ;)

 Respond  
Hawkee   -  Mar 27, 2010

You saved this as an mIRC snippet, not Python.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.