Skip to content

Instantly share code, notes, and snippets.

@mayuki
Created November 10, 2009 05:38
Show Gist options
  • Select an option

  • Save mayuki/230648 to your computer and use it in GitHub Desktop.

Select an option

Save mayuki/230648 to your computer and use it in GitHub Desktop.
import clr
from System.Net import WebClient
from Misuzilla.Applications.TwitterIrcGateway import Status, Statuses, User, Users, Utility
from Misuzilla.Applications.TwitterIrcGateway.AddIns import IConfiguration
from Misuzilla.Applications.TwitterIrcGateway.AddIns.Console import ConsoleAddIn, Console, Context
from Misuzilla.Applications.TwitterIrcGateway.AddIns.DLRIntegration import DLRIntegrationAddIn, DLRBasicConfiguration, DLRContextHelper
# タイムラインをクライアントに送信する直前のイベントハンドラ
def OnPreSendMessageTimelineStatus(sender, e):
webClient = WebClient()
webClient.UploadString("http://example.com", Utility.UrlEncode("%s: %s" % (e.Status.User.Name, e.Text)))
# 後片付けイベントハンドラ(これを行わないとイベントが外れないのでリロードするたびに増えてしまう)
def OnBeforeUnload(sender, e):
Session.PreSendMessageTimelineStatus -= OnPreSendMessageTimelineStatus
# イベントハンドラを接続
Session.PreSendMessageTimelineStatus += OnPreSendMessageTimelineStatus
Session.AddInManager.GetAddIn[DLRIntegrationAddIn]().BeforeUnload += OnBeforeUnload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment