Skip to content

Instantly share code, notes, and snippets.

@mashiro
Created August 5, 2010 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mashiro/509492 to your computer and use it in GitHub Desktop.
Save mashiro/509492 to your computer and use it in GitHub Desktop.
#!/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