Last active
October 11, 2020 09:04
-
-
Save shufo/c35d8302fea1611af8c7 to your computer and use it in GitHub Desktop.
Skype-bot script
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
#!python2.6 | |
#coding: utf-8 | |
import Skype4Py | |
import os, sys, time, struct, re | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
os.environ["DISPLAY"] = ":20" | |
os.environ["XAUTHORITY"] = "/var/run/skype/Xauthority" | |
try: skype = Skype4Py.Skype(Transport='x11') | |
except Skype4Py.errors.ISkypeAPIError, e: | |
print "Error creating skype object: ", e; | |
exit(1); | |
def OnMessageStatus(msg, event): | |
print "message: " + msg.Body | |
print "status: " + msg.Status | |
print "type: " + msg.Type | |
print "Datetime: " + str(msg.Datetime) | |
print "FromDisplayName: " + msg.FromDisplayName.encode('utf-8') | |
if event == u'RECEIVED': | |
if re.search(u'ぬるぽ|ヌルポ|ヌルポ', msg.Body) != None: | |
msg.Chat.SendMessage("ガッ") | |
skype.OnMessageStatus = OnMessageStatus | |
skype.Attach() | |
while True: | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I saw "After October 31st, 2019, the Skype bot channel will no longer be accepting new registrations, however, existing bots will continue to work." - so, does anyone know if we will still be able to make and use our own Skype Bots?