Skip to content

Instantly share code, notes, and snippets.

@mashiro mashiro/getdm.py
Created Aug 5, 2010

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.