Created
May 10, 2011 07:48
-
-
Save sotarok/964061 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import os | |
import time | |
import datetime | |
import re | |
import Skype4Py | |
def print_log(chat, event, from_handle, log): | |
print "[%s][%s][%s] %s : %s" % (event, chat.Name, chat.Datetime, from_handle, log) | |
def skype_handler(msg, event): | |
chat = msg.Chat | |
print_log(chat, event, msg.FromHandle, msg.Body) | |
if event == u"RECEIVED" or event == u"READ": | |
message = re.search('^@name', msg.Body) | |
if message is not None: | |
msg.Chat.SendMessage(msg.Chat.Name) | |
def main(): | |
print time.time() | |
skype = Skype4Py.Skype() | |
skype.OnMessageStatus = skype_handler | |
skype.Attach() | |
for chat in skype.Chats: | |
print chat.Name, chat.Topic | |
while 1: | |
time.sleep(1) | |
print "end" | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment