Created
August 5, 2010 09:47
-
-
Save mashiro/509492 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 | |
# -*- encoding: utf-8 -*- | |
from System.Reflection import BindingFlags | |
from Misuzilla.Applications.TwitterIrcGateway.AddIns.DLRIntegration import DLRIntegrationAddIn | |
def invoke(instance, name, *args): | |
type = instance.GetType() | |
method = type.GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) | |
method.Invoke(instance, args) | |
def on_message_received(sender, e): | |
if e.Message.Command.upper() != "TIGGETDM": | |
return | |
invoke(CurrentSession.TwitterService, 'OnTimerCallbackDirectMessage', None) | |
CurrentSession.SendTwitterGatewayServerMessage('DM を取得しました。') | |
def on_before_unload(sender, e): | |
CurrentSession.MessageReceived -= on_message_received | |
CurrentSession.MessageReceived += on_message_received | |
CurrentSession.AddInManager.GetAddIn[DLRIntegrationAddIn]().BeforeUnload += on_before_unload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment