THREAD: [Python]How to make a quick skype bot
  1. 10-13-2015, 11:13 AM
    Python's Avatar
    Python
    Bebe Snek
    Python's Avatar
    Python
    Bebe Snek
    864
    Posts
    25,567
    Reputation
    Nov 2011
    NextGenUpdate
    Hello NGU community! Today I'm going to show you how to make a quick SkypeBot.

    First you need Python 2.7.10. You can get it You must login or register to view this content.

    Okay so let's get into it!

    Steps!

    Step 1. Open your System by going to Control Panel System & Security And then System Once there click advanced settings.

    Step 2. Once in Advanced Settings click Environment Variables. You must login or register to view this content.

    Step 3. Scroll down System Variables until you find path. You must login or register to view this content.

    Step 4. Click path and then click edit. Go to the very end of path and put this code
    ;C:/Python27
    Once you put that click save and close out system.

    Step 5. Download these two files. You must login or register to view this content.
    You must login or register to view this content. Once downloaded extract the files to yout desktop

    Step 6. Open your cmd prompt. Once open type in
    cd desktop
    Once done type cd again and press tab until you see
    You must login or register to view this content.. Once you see that press enter! Now type in
    python setup.py install
    then press enter! It will install everything. once it's done close and then re-open your cmd prompt and do the same thing as last time. Except this time press tab until you see skype4py-master You must login or register to view this content. type in the same commands as last time
    python setup.py install


    Step 7. Take the code below and paste into a text file and save it as SkypeBot.py Once saved run it and attach to skype. After that you should be good to go!. (feel free to edit it and add in your own commands)
    # -*- coding: UTF8 -*-
    import Skype4Py
    import re
    import urllib
    import getpass
    import urllib2
    import xml
    from sgmllib import SGMLParser
    import time
    import json
    import random
    import sys, os
    import codecs
    from HTMLParser import HTMLParser

    class MLStripper(HTMLParser):
    def __init__(self):
    self.reset()
    self.fed = []
    def handle_data(self, d):
    self.fed.append(d)
    def get_data(self):
    return ''.join(self.fed)

    def strip_tags(html):
    s = MLStripper()
    s.feed(html)
    return s.get_data()
    def getHandle():
    return getAPI().CurrentUser.Handle
    def getBetween(strSource, strStart,strEnd):
    start = strSource.find(strStart) + len(strStart)
    end = strSource.find(strEnd,start)
    return strSource[start:end]

    class SkypeBot:
    def __init__(self):
    self.skype = Skype4Py.Skype(Events=self)
    self.skype.Attach()

    def AttachmentStatus(self, status):
    if status == Skype4Py.apiAttachAvailable:
    self.skype.attach()
    def MessageStatus(self, message, status):
    if status == Skype4Py.cmsReceived or status == Skype4Py.cmsSent:
    splitMessage = message.Body.split()
    for command, function in self.commands.items():
    if command in splitMessage[0]:
    function(self, message)
    break
    def commandJoke(self, message):
    shitt = urllib2.urlopen('https://www.jokesclean.com/OneLiner/Random/'Winky Winky.read()
    shit = getBetween(shitt,'<p class="c"> <font size="+2">',"</font></p>")
    message.Chat.SendMessage(strip_tags('/me'+shit))
    def commandFml(self,message):
    tit = urllib2.urlopen('https://m.fmylife.com/random'Winky Winky.read()
    fml = getBetween(tit,'<p class="text">','</p>'Winky Winky
    message.Chat.SendMessage(strip_tags('/me '+fml))
    def commandFml(self,message):
    dataa = urllib2.urlopen('https://m.fmylife.com/random'Winky Winky.read()
    fml = getBetween(dataa,'<p class="text">','</p>'Winky Winky
    message.Chat.SendMessage(strip_tags('/me '+fml))
    def commandUrban(self, message):
    urban = message.Body.split('define'Winky Winky
    word = urban[1].strip()
    r = urllib2.urlopen('https://api.urbandictionary.com/v0/define?term='+ word)
    data = json.loads(r.read())
    if ( len(data['list']) > 1 ):
    data['list'] = data['list'][:1] # only print 2 results
    for i in range(len(data['list'])):
    word = data['list'][u'word']
    definition = data['list'][u'definition']
    example = data['list'][u'example']
    permalink = data['list'][u'permalink']
    message.Chat.SendMessage('/me '+word+': ' + definition),
    message.Chat.SendMessage('/me Example: ' + example)
    else:
    print 'Word not found.'

    def command8ball(self, message):
    splitMessage = message.Body.split(' ',1)
    messageText = splitMessage[1]
    Choice = ["It is certain",
    "It is decidedly so",
    "Without a doubt",
    "Yes definitely",
    "You may rely on it",
    "As I see it, yes",
    "Most likely",
    "Outlook good",
    "Yes",
    "Signs point to yes",
    "Reply hazy try again",
    "Ask again later",
    "Better not tell you now",
    "Cannot predict now",
    "Concentrate and ask again",
    "Don't count on it",
    "My reply is no",
    "My sources say no",
    "Outlook not so good",
    "Very doubtful"]
    time.sleep(2)
    message.Chat.SendMessage('/me '+Choice[random.randint(0,11)])
    def commandTube(self, message):
    global Finder
    global Finder2
    splitMessage = message.Body.split(' ',1)
    Finder = message.Body.split(' ',5)
    Finder2 = message.Body.split(' ',5)
    messageText = splitMessage[1]
    SplitSearch = splitMessage[1].replace(' ','+'Winky Winky
    URL = urllib2.urlopen('https://www.youtube.com/results?q='+SplitSearch).read()
    String = re.findall(r'\/watch\?v=\w{11}',URL)
    Array = []
    for x in String:
    if x in Array:
    pass
    else:
    Array.append(x)
    #print Array
    message.Chat.SendMessage('/me Searching (3) Results for: '+messageText)
    for i in Array[0:3]:
    time.sleep(2)
    message.Chat.SendMessage('/me https://youtube.com'+i)
    def commandPing(self, message):
    message.Chat.SendMessage('/me pong'Winky Winky
    def commandDice(self, message):
    message.Chat.SendMessage('/me Put a bet on numbers 1 through 6.'Winky Winky
    time.sleep(Cool Man (aka Tustin)
    rolled = random.randint(1,6)
    message.Chat.SendMessage('/me *rolls dice*'Winky Winky
    time.sleep(1)
    message.Chat.SendMessage('/me The dice rolled the number:'Winky Winky
    rolled = str(rolled)
    message.Chat.SendMessage("/me "+rolled)
    def commandSay(self, message):
    splitMessage = message.Body.split(' ',1)
    messageText = splitMessage[1]
    message.Chat.SendMessage('/me '+messageText)
    def commandGoogle(self, message):
    splitMessage = message.Body.split(' ',1)
    messageText = splitMessage[1]
    message.Chat.SendMessage("/me https://lmgtfy.com/?q="+messageText)
    def commandResolve(self, message):
    ips = message.Body.split('resolve'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/resolver/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Grabbing Latest IP for the user ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me %s' % response)
    def commandWebres(self, message):
    ips = message.Body.split('webresolve'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/cfwresolve/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Grabbing the IP for the website ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me %s' % response)
    def commandPwgen(self, message):
    ips = message.Body.split('pwgen'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/passgen/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating Password ["+ip+"] charactors long.")
    time.sleep(2)
    message.Chat.SendMessage('/me %s' % response)
    def commandSlap(self, message):
    ips = message.Body.split('slap'Winky Winky
    ip = ips[1].strip()
    message.Chat.SendMessage("/me has slapped "+ip+"'s ass. Winky Winky")
    def commandKiss(self, message):
    ips = message.Body.split('kiss'Winky Winky
    ip = ips[1].strip()
    message.Chat.SendMessage("/me has given "+ip+" a big fat kiss :*")
    def commandTopicAppend(self, message):
    messageSplit = message.Body.split()[1:]
    message.Chat.SendMessage('/topic %s | %s' % (message.Chat.Topic, ' '.join(messageSplit)))
    def commandCommands(self, message):
    message.Chat.SendMessage('/me Commands:Working on posting more commands'Winky Winky
    def commandGeo(self, message):
    ips = message.Body.split('geo'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/geoip/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating data on the IP ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage(strip_tags('/me '+response))
    def commandIpHost(self, message):
    ips = message.Body.split('ip2host'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/ip2host/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating data on the IP ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me '+response)
    def commandIpSkype(self, message):
    ips = message.Body.split('ip2skype'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/lookup/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating data on the IP ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me '+response)
    def commandInsult(self, message):
    while 1:
    try:
    message.Chat.SendMessage('this groupchat is Weird'Winky Winky
    except Exception,e:
    message.Chat.SendMessage('spam'Winky Winky
    else:
    message.Chat.SendMessage('skype4py ftw spam spam spam'Winky Winky

    commands = {
    '!ping': commandPing,
    '!topicappend': commandTopicAppend,
    '!joke': commandJoke,
    '!dice': commandDice,
    '!say': commandSay,
    '!resolve': commandResolve,
    '!tube': commandTube,
    '!8ball':command8ball,
    '!define': commandUrban,
    '!google': commandGoogle,
    '!commands': commandCommands,
    '!pwgen': commandPwgen,
    '!ip2skype': commandIpSkype,
    '!fml': commandFml,
    '!slap': commandSlap,
    '!kiss': commandKiss,
    '!webresolve': commandWebres,
    '!geo': commandGeo,
    '!spam': commandInsult,
    '!cmds': commandCommands
    }

    if __name__ == '__main__':
    bot = SkypeBot()

    while True:
    print(' skype bot 'Winky Winky

    skype = Skype4Py.Skype();
    print ' User Running Skypebot:',skype.CurrentUserHandle, "\n"
    print(' You are a [ Admin ] User 'Winky Winky

    raw_input()


    Sorry if the thread looks like trash. But I hope you guys enjoy!
    Last edited by Python ; 10-13-2015 at 11:14 AM. Reason: Changed a word

  2. The Following 2 Users Say Thank You to Python For This Useful Post:


  3. 10-13-2015, 02:41 PM
    Passion's Avatar
    Passion
    League Champion
    Passion's Avatar
    Passion
    League Champion
    1,750
    Posts
    33,111
    Reputation
    Apr 2015
    NextGenUpdate
    Originally Posted by Python View Post
    Hello NGU community! Today I'm going to show you how to make a quick SkypeBot.

    First you need Python 2.7.10. You can get it You must login or register to view this content.

    Okay so let's get into it!

    Steps!

    Step 1. Open your System by going to Control Panel System & Security And then System Once there click advanced settings.

    Step 2. Once in Advanced Settings click Environment Variables. You must login or register to view this content.

    Step 3. Scroll down System Variables until you find path. You must login or register to view this content.

    Step 4. Click path and then click edit. Go to the very end of path and put this code
    ;C:/Python27
    Once you put that click save and close out system.

    Step 5. Download these two files. You must login or register to view this content.
    You must login or register to view this content. Once downloaded extract the files to yout desktop

    Step 6. Open your cmd prompt. Once open type in
    cd desktop
    Once done type cd again and press tab until you see
    You must login or register to view this content.. Once you see that press enter! Now type in
    python setup.py install
    then press enter! It will install everything. once it's done close and then re-open your cmd prompt and do the same thing as last time. Except this time press tab until you see skype4py-master You must login or register to view this content. type in the same commands as last time
    python setup.py install


    Step 7. Take the code below and paste into a text file and save it as SkypeBot.py Once saved run it and attach to skype. After that you should be good to go!. (feel free to edit it and add in your own commands)
    # -*- coding: UTF8 -*-
    import Skype4Py
    import re
    import urllib
    import getpass
    import urllib2
    import xml
    from sgmllib import SGMLParser
    import time
    import json
    import random
    import sys, os
    import codecs
    from HTMLParser import HTMLParser

    class MLStripper(HTMLParser):
    def __init__(self):
    self.reset()
    self.fed = []
    def handle_data(self, d):
    self.fed.append(d)
    def get_data(self):
    return ''.join(self.fed)

    def strip_tags(html):
    s = MLStripper()
    s.feed(html)
    return s.get_data()
    def getHandle():
    return getAPI().CurrentUser.Handle
    def getBetween(strSource, strStart,strEnd):
    start = strSource.find(strStart) + len(strStart)
    end = strSource.find(strEnd,start)
    return strSource[start:end]

    class SkypeBot:
    def __init__(self):
    self.skype = Skype4Py.Skype(Events=self)
    self.skype.Attach()

    def AttachmentStatus(self, status):
    if status == Skype4Py.apiAttachAvailable:
    self.skype.attach()
    def MessageStatus(self, message, status):
    if status == Skype4Py.cmsReceived or status == Skype4Py.cmsSent:
    splitMessage = message.Body.split()
    for command, function in self.commands.items():
    if command in splitMessage[0]:
    function(self, message)
    break
    def commandJoke(self, message):
    shitt = urllib2.urlopen('https://www.jokesclean.com/OneLiner/Random/'Winky Winky.read()
    shit = getBetween(shitt,'<p class="c"> <font size="+2">',"</font></p>")
    message.Chat.SendMessage(strip_tags('/me'+shit))
    def commandFml(self,message):
    tit = urllib2.urlopen('https://m.fmylife.com/random'Winky Winky.read()
    fml = getBetween(tit,'<p class="text">','</p>'Winky Winky
    message.Chat.SendMessage(strip_tags('/me '+fml))
    def commandFml(self,message):
    dataa = urllib2.urlopen('https://m.fmylife.com/random'Winky Winky.read()
    fml = getBetween(dataa,'<p class="text">','</p>'Winky Winky
    message.Chat.SendMessage(strip_tags('/me '+fml))
    def commandUrban(self, message):
    urban = message.Body.split('define'Winky Winky
    word = urban[1].strip()
    r = urllib2.urlopen('https://api.urbandictionary.com/v0/define?term='+ word)
    data = json.loads(r.read())
    if ( len(data['list']) > 1 ):
    data['list'] = data['list'][:1] # only print 2 results
    for i in range(len(data['list'])):
    word = data['list'][u'word']
    definition = data['list'][u'definition']
    example = data['list'][u'example']
    permalink = data['list'][u'permalink']
    message.Chat.SendMessage('/me '+word+': ' + definition),
    message.Chat.SendMessage('/me Example: ' + example)
    else:
    print 'Word not found.'

    def command8ball(self, message):
    splitMessage = message.Body.split(' ',1)
    messageText = splitMessage[1]
    Choice = ["It is certain",
    "It is decidedly so",
    "Without a doubt",
    "Yes definitely",
    "You may rely on it",
    "As I see it, yes",
    "Most likely",
    "Outlook good",
    "Yes",
    "Signs point to yes",
    "Reply hazy try again",
    "Ask again later",
    "Better not tell you now",
    "Cannot predict now",
    "Concentrate and ask again",
    "Don't count on it",
    "My reply is no",
    "My sources say no",
    "Outlook not so good",
    "Very doubtful"]
    time.sleep(2)
    message.Chat.SendMessage('/me '+Choice[random.randint(0,11)])
    def commandTube(self, message):
    global Finder
    global Finder2
    splitMessage = message.Body.split(' ',1)
    Finder = message.Body.split(' ',5)
    Finder2 = message.Body.split(' ',5)
    messageText = splitMessage[1]
    SplitSearch = splitMessage[1].replace(' ','+'Winky Winky
    URL = urllib2.urlopen('https://www.youtube.com/results?q='+SplitSearch).read()
    String = re.findall(r'\/watch\?v=\w{11}',URL)
    Array = []
    for x in String:
    if x in Array:
    pass
    else:
    Array.append(x)
    #print Array
    message.Chat.SendMessage('/me Searching (3) Results for: '+messageText)
    for i in Array[0:3]:
    time.sleep(2)
    message.Chat.SendMessage('/me https://youtube.com'+i)
    def commandPing(self, message):
    message.Chat.SendMessage('/me pong'Winky Winky
    def commandDice(self, message):
    message.Chat.SendMessage('/me Put a bet on numbers 1 through 6.'Winky Winky
    time.sleep(Cool Man (aka Tustin)
    rolled = random.randint(1,6)
    message.Chat.SendMessage('/me *rolls dice*'Winky Winky
    time.sleep(1)
    message.Chat.SendMessage('/me The dice rolled the number:'Winky Winky
    rolled = str(rolled)
    message.Chat.SendMessage("/me "+rolled)
    def commandSay(self, message):
    splitMessage = message.Body.split(' ',1)
    messageText = splitMessage[1]
    message.Chat.SendMessage('/me '+messageText)
    def commandGoogle(self, message):
    splitMessage = message.Body.split(' ',1)
    messageText = splitMessage[1]
    message.Chat.SendMessage("/me https://lmgtfy.com/?q="+messageText)
    def commandResolve(self, message):
    ips = message.Body.split('resolve'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/resolver/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Grabbing Latest IP for the user ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me %s' % response)
    def commandWebres(self, message):
    ips = message.Body.split('webresolve'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/cfwresolve/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Grabbing the IP for the website ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me %s' % response)
    def commandPwgen(self, message):
    ips = message.Body.split('pwgen'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/passgen/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating Password ["+ip+"] charactors long.")
    time.sleep(2)
    message.Chat.SendMessage('/me %s' % response)
    def commandSlap(self, message):
    ips = message.Body.split('slap'Winky Winky
    ip = ips[1].strip()
    message.Chat.SendMessage("/me has slapped "+ip+"'s ass. Winky Winky")
    def commandKiss(self, message):
    ips = message.Body.split('kiss'Winky Winky
    ip = ips[1].strip()
    message.Chat.SendMessage("/me has given "+ip+" a big fat kiss :*")
    def commandTopicAppend(self, message):
    messageSplit = message.Body.split()[1:]
    message.Chat.SendMessage('/topic %s | %s' % (message.Chat.Topic, ' '.join(messageSplit)))
    def commandCommands(self, message):
    message.Chat.SendMessage('/me Commands:Working on posting more commands'Winky Winky
    def commandGeo(self, message):
    ips = message.Body.split('geo'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/geoip/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating data on the IP ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage(strip_tags('/me '+response))
    def commandIpHost(self, message):
    ips = message.Body.split('ip2host'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/ip2host/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating data on the IP ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me '+response)
    def commandIpSkype(self, message):
    ips = message.Body.split('ip2skype'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/lookup/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating data on the IP ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me '+response)
    def commandInsult(self, message):
    while 1:
    try:
    message.Chat.SendMessage('this groupchat is Weird'Winky Winky
    except Exception,e:
    message.Chat.SendMessage('spam'Winky Winky
    else:
    message.Chat.SendMessage('skype4py ftw spam spam spam'Winky Winky

    commands = {
    '!ping': commandPing,
    '!topicappend': commandTopicAppend,
    '!joke': commandJoke,
    '!dice': commandDice,
    '!say': commandSay,
    '!resolve': commandResolve,
    '!tube': commandTube,
    '!8ball':command8ball,
    '!define': commandUrban,
    '!google': commandGoogle,
    '!commands': commandCommands,
    '!pwgen': commandPwgen,
    '!ip2skype': commandIpSkype,
    '!fml': commandFml,
    '!slap': commandSlap,
    '!kiss': commandKiss,
    '!webresolve': commandWebres,
    '!geo': commandGeo,
    '!spam': commandInsult,
    '!cmds': commandCommands
    }

    if __name__ == '__main__':
    bot = SkypeBot()

    while True:
    print(' skype bot 'Winky Winky

    skype = Skype4Py.Skype();
    print ' User Running Skypebot:',skype.CurrentUserHandle, "\n"
    print(' You are a [ Admin ] User 'Winky Winky

    raw_input()


    Sorry if the thread looks like trash. But I hope you guys enjoy!


    This wasn't really helpful. lol
  4. The Following User Thanked Passion For This Useful Post:


  5. 10-13-2015, 07:42 PM
    Eddie-Lucas's Avatar
    Eddie-Lucas
    < ^ > < ^ >
    Eddie-Lucas's Avatar
    Eddie-Lucas
    < ^ > < ^ >
    1,294
    Posts
    14,026
    Reputation
    Jul 2013
    NextGenUpdate
    this is 100% useless......... sorry mate... just being honest. your trying to become known around the site I see but posting crap is not the reputation you want to be known for.
  6. The Following 2 Users Say Thank You to Eddie-Lucas For This Useful Post:

    ,

  7. 10-13-2015, 08:53 PM
    Winter's Avatar
    Winter
    <span style="background:url(http://i.imgur.com/ErUqTqV.gif);font-weight:bold;color:purple;">Purple God</span>
    Winter's Avatar
    Winter
    <span style="background:url(http://i.imgur.com/ErUqTqV.gif);font-weight:bold;color:purple;">Purple God</span>
    1,502
    Posts
    21,608
    Reputation
    Aug 2012
    NextGenUpdate
    Originally Posted by Python View Post
    Hello NGU community! Today I'm going to show you how to make a quick SkypeBot.

    First you need Python 2.7.10. You can get it You must login or register to view this content.

    Okay so let's get into it!

    Steps!

    Step 1. Open your System by going to Control Panel System & Security And then System Once there click advanced settings.

    Step 2. Once in Advanced Settings click Environment Variables. You must login or register to view this content.

    Step 3. Scroll down System Variables until you find path. You must login or register to view this content.

    Step 4. Click path and then click edit. Go to the very end of path and put this code
    ;C:/Python27
    Once you put that click save and close out system.

    Step 5. Download these two files. You must login or register to view this content.
    You must login or register to view this content. Once downloaded extract the files to yout desktop

    Step 6. Open your cmd prompt. Once open type in
    cd desktop
    Once done type cd again and press tab until you see
    You must login or register to view this content.. Once you see that press enter! Now type in
    python setup.py install
    then press enter! It will install everything. once it's done close and then re-open your cmd prompt and do the same thing as last time. Except this time press tab until you see skype4py-master You must login or register to view this content. type in the same commands as last time
    python setup.py install


    Step 7. Take the code below and paste into a text file and save it as SkypeBot.py Once saved run it and attach to skype. After that you should be good to go!. (feel free to edit it and add in your own commands)
    # -*- coding: UTF8 -*-
    import Skype4Py
    import re
    import urllib
    import getpass
    import urllib2
    import xml
    from sgmllib import SGMLParser
    import time
    import json
    import random
    import sys, os
    import codecs
    from HTMLParser import HTMLParser

    class MLStripper(HTMLParser):
    def __init__(self):
    self.reset()
    self.fed = []
    def handle_data(self, d):
    self.fed.append(d)
    def get_data(self):
    return ''.join(self.fed)

    def strip_tags(html):
    s = MLStripper()
    s.feed(html)
    return s.get_data()
    def getHandle():
    return getAPI().CurrentUser.Handle
    def getBetween(strSource, strStart,strEnd):
    start = strSource.find(strStart) + len(strStart)
    end = strSource.find(strEnd,start)
    return strSource[start:end]

    class SkypeBot:
    def __init__(self):
    self.skype = Skype4Py.Skype(Events=self)
    self.skype.Attach()

    def AttachmentStatus(self, status):
    if status == Skype4Py.apiAttachAvailable:
    self.skype.attach()
    def MessageStatus(self, message, status):
    if status == Skype4Py.cmsReceived or status == Skype4Py.cmsSent:
    splitMessage = message.Body.split()
    for command, function in self.commands.items():
    if command in splitMessage[0]:
    function(self, message)
    break
    def commandJoke(self, message):
    shitt = urllib2.urlopen('https://www.jokesclean.com/OneLiner/Random/'Winky Winky.read()
    shit = getBetween(shitt,'<p class="c"> <font size="+2">',"</font></p>")
    message.Chat.SendMessage(strip_tags('/me'+shit))
    def commandFml(self,message):
    tit = urllib2.urlopen('https://m.fmylife.com/random'Winky Winky.read()
    fml = getBetween(tit,'<p class="text">','</p>'Winky Winky
    message.Chat.SendMessage(strip_tags('/me '+fml))
    def commandFml(self,message):
    dataa = urllib2.urlopen('https://m.fmylife.com/random'Winky Winky.read()
    fml = getBetween(dataa,'<p class="text">','</p>'Winky Winky
    message.Chat.SendMessage(strip_tags('/me '+fml))
    def commandUrban(self, message):
    urban = message.Body.split('define'Winky Winky
    word = urban[1].strip()
    r = urllib2.urlopen('https://api.urbandictionary.com/v0/define?term='+ word)
    data = json.loads(r.read())
    if ( len(data['list']) > 1 ):
    data['list'] = data['list'][:1] # only print 2 results
    for i in range(len(data['list'])):
    word = data['list'][u'word']
    definition = data['list'][u'definition']
    example = data['list'][u'example']
    permalink = data['list'][u'permalink']
    message.Chat.SendMessage('/me '+word+': ' + definition),
    message.Chat.SendMessage('/me Example: ' + example)
    else:
    print 'Word not found.'

    def command8ball(self, message):
    splitMessage = message.Body.split(' ',1)
    messageText = splitMessage[1]
    Choice = ["It is certain",
    "It is decidedly so",
    "Without a doubt",
    "Yes definitely",
    "You may rely on it",
    "As I see it, yes",
    "Most likely",
    "Outlook good",
    "Yes",
    "Signs point to yes",
    "Reply hazy try again",
    "Ask again later",
    "Better not tell you now",
    "Cannot predict now",
    "Concentrate and ask again",
    "Don't count on it",
    "My reply is no",
    "My sources say no",
    "Outlook not so good",
    "Very doubtful"]
    time.sleep(2)
    message.Chat.SendMessage('/me '+Choice[random.randint(0,11)])
    def commandTube(self, message):
    global Finder
    global Finder2
    splitMessage = message.Body.split(' ',1)
    Finder = message.Body.split(' ',5)
    Finder2 = message.Body.split(' ',5)
    messageText = splitMessage[1]
    SplitSearch = splitMessage[1].replace(' ','+'Winky Winky
    URL = urllib2.urlopen('https://www.youtube.com/results?q='+SplitSearch).read()
    String = re.findall(r'\/watch\?v=\w{11}',URL)
    Array = []
    for x in String:
    if x in Array:
    pass
    else:
    Array.append(x)
    #print Array
    message.Chat.SendMessage('/me Searching (3) Results for: '+messageText)
    for i in Array[0:3]:
    time.sleep(2)
    message.Chat.SendMessage('/me https://youtube.com'+i)
    def commandPing(self, message):
    message.Chat.SendMessage('/me pong'Winky Winky
    def commandDice(self, message):
    message.Chat.SendMessage('/me Put a bet on numbers 1 through 6.'Winky Winky
    time.sleep(Cool Man (aka Tustin)
    rolled = random.randint(1,6)
    message.Chat.SendMessage('/me *rolls dice*'Winky Winky
    time.sleep(1)
    message.Chat.SendMessage('/me The dice rolled the number:'Winky Winky
    rolled = str(rolled)
    message.Chat.SendMessage("/me "+rolled)
    def commandSay(self, message):
    splitMessage = message.Body.split(' ',1)
    messageText = splitMessage[1]
    message.Chat.SendMessage('/me '+messageText)
    def commandGoogle(self, message):
    splitMessage = message.Body.split(' ',1)
    messageText = splitMessage[1]
    message.Chat.SendMessage("/me https://lmgtfy.com/?q="+messageText)
    def commandResolve(self, message):
    ips = message.Body.split('resolve'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/resolver/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Grabbing Latest IP for the user ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me %s' % response)
    def commandWebres(self, message):
    ips = message.Body.split('webresolve'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/cfwresolve/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Grabbing the IP for the website ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me %s' % response)
    def commandPwgen(self, message):
    ips = message.Body.split('pwgen'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/passgen/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating Password ["+ip+"] charactors long.")
    time.sleep(2)
    message.Chat.SendMessage('/me %s' % response)
    def commandSlap(self, message):
    ips = message.Body.split('slap'Winky Winky
    ip = ips[1].strip()
    message.Chat.SendMessage("/me has slapped "+ip+"'s ass. Winky Winky")
    def commandKiss(self, message):
    ips = message.Body.split('kiss'Winky Winky
    ip = ips[1].strip()
    message.Chat.SendMessage("/me has given "+ip+" a big fat kiss :*")
    def commandTopicAppend(self, message):
    messageSplit = message.Body.split()[1:]
    message.Chat.SendMessage('/topic %s | %s' % (message.Chat.Topic, ' '.join(messageSplit)))
    def commandCommands(self, message):
    message.Chat.SendMessage('/me Commands:Working on posting more commands'Winky Winky
    def commandGeo(self, message):
    ips = message.Body.split('geo'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/geoip/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating data on the IP ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage(strip_tags('/me '+response))
    def commandIpHost(self, message):
    ips = message.Body.split('ip2host'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/ip2host/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating data on the IP ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me '+response)
    def commandIpSkype(self, message):
    ips = message.Body.split('ip2skype'Winky Winky
    ip = ips[1].strip()
    response = urllib2.urlopen("https://api.predator.wtf/lookup/?arguments="+ ip).read()
    message.Chat.SendMessage("/me Generating data on the IP ["+ip+"].")
    time.sleep(2)
    message.Chat.SendMessage('/me '+response)
    def commandInsult(self, message):
    while 1:
    try:
    message.Chat.SendMessage('this groupchat is Weird'Winky Winky
    except Exception,e:
    message.Chat.SendMessage('spam'Winky Winky
    else:
    message.Chat.SendMessage('skype4py ftw spam spam spam'Winky Winky

    commands = {
    '!ping': commandPing,
    '!topicappend': commandTopicAppend,
    '!joke': commandJoke,
    '!dice': commandDice,
    '!say': commandSay,
    '!resolve': commandResolve,
    '!tube': commandTube,
    '!8ball':command8ball,
    '!define': commandUrban,
    '!google': commandGoogle,
    '!commands': commandCommands,
    '!pwgen': commandPwgen,
    '!ip2skype': commandIpSkype,
    '!fml': commandFml,
    '!slap': commandSlap,
    '!kiss': commandKiss,
    '!webresolve': commandWebres,
    '!geo': commandGeo,
    '!spam': commandInsult,
    '!cmds': commandCommands
    }

    if __name__ == '__main__':
    bot = SkypeBot()

    while True:
    print(' skype bot 'Winky Winky

    skype = Skype4Py.Skype();
    print ' User Running Skypebot:',skype.CurrentUserHandle, "\n"
    print(' You are a [ Admin ] User 'Winky Winky

    raw_input()


    Sorry if the thread looks like trash. But I hope you guys enjoy!


    See what I mean? Look at the comments. I warned you this would happen. tears Also, why Py27 and not 34? Py27 comes with IDA I know that much but I'm just wondering why 27
  8. 10-14-2015, 04:13 AM
    Danny's Avatar
    Danny
    Hurah!
    Danny's Avatar
    Danny
    Hurah!
    660
    Posts
    4,103
    Reputation
    Jul 2012
    NextGenUpdate
    Nice tutorial for someone who doesn't even know this language. Guessing you copied and pasted this to?
  9. 10-14-2015, 05:00 AM
    Python's Avatar
    Python
    Bebe Snek
    Python's Avatar
    Python
    Bebe Snek
    864
    Posts
    25,567
    Reputation
    Nov 2011
    NextGenUpdate
    Originally Posted by Lucas View Post
    this is 100% useless......... sorry mate... just being honest. your trying to become known around the site I see but posting crap is not the reputation you want to be known for.


    Thanks for the honest feedback Happy . I shall ask someone to remove this thread
  10. 10-14-2015, 05:02 AM
    Python's Avatar
    Python
    Bebe Snek
    Python's Avatar
    Python
    Bebe Snek
    864
    Posts
    25,567
    Reputation
    Nov 2011
    NextGenUpdate
    Originally Posted by Passion View Post
    This wasn't really helpful. lol


    Thank you for your feedback Happy. The thread will be removed soon