Created
April 2, 2015 02:43
-
-
Save MrMetric/791c17eb99097ccd2d5c to your computer and use it in GitHub Desktop.
Adds perverts to the MLF chat
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
from __future__ import print_function | |
import Skype4Py, sys | |
skype = Skype4Py.Skype() | |
skype.Attach() | |
chat = None | |
for chat_ in skype.RecentChats: | |
if '/mlf/' in chat_.Topic.lower(): | |
print(u'Found chat: {}'.format(chat_.Topic)) | |
chat = chat_ | |
break | |
if chat == None: | |
print('Did not find chat') | |
exit() | |
def got_contact_request(User): | |
print('Got request from {}: {}'.format(User.Handle, User.ReceivedAuthRequest)) | |
if 'mlf' in User.ReceivedAuthRequest.lower(): | |
print('Message mentions MLF') | |
User.IsAuthorized = True | |
User.SetBuddyStatusPendingAuthorization() | |
try: | |
chat.SendMessage(u'/add {}'.format(User.Handle)) | |
except Skype4Py.SkypeError as error: | |
print(error) | |
skype.OnUserAuthorizationRequestReceived = got_contact_request | |
while True: | |
try: | |
chat.SendMessage(sys.stdin.read()) | |
except Skype4Py.SkypeError as error: | |
print(error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment