Need Skype4Py and Eliza
- skype_bot.py
#!/usr/bin/env python
import Skype4Py #http://skype4py.sourceforge.net/doc/html/
import gobject
import inspect
#import random as whrandom
import eliza
print "Using skype4py " + Skype4Py.__version__
def funcname():
return inspect.stack()[1][3]
class MySkypeEvents:
def AttachmentStatus(self, status):
if status == Skype4Py.apiAttachAvailable:
self.Attach();
if status == Skype4Py.apiAttachSuccess:
print "Connected to skype client"
def UserStatus(self, status):
print ('%s-status: ' + status) % funcname()
def Notify(self, notification):
print ('%s-notification: ' + notification) % funcname()
def MessageStatus(self, message, status):
if status == 'RECEIVED':
print(message.FromDisplayName + ': ' + message.Body)
reply = bot.respond(message.Body)
print reply
skype.SendMessage(message.FromHandle, reply)
elif status == 'SENT':
print('Myself: ' + message.Body)
else:
print "unknown status: " + status
# Create an instance of the Skype class.
skype = Skype4Py.Skype(Events=MySkypeEvents())
# Connect the Skype object to the Skype client.
skype.Attach()
# Obtain some information from the client and print it out.
print 'Your full name:', skype.CurrentUser.FullName
print 'Your contacts:'
for user in skype.Friends:
print ' ' + user.Handle + " aka " + user.FullName
bot = eliza.eliza()
Cmd = '';
while not Cmd == 'exit':
Cmd = raw_input('');