Skip to content

Instantly share code, notes, and snippets.

@kb10uy
Last active August 29, 2015 14:03
Show Gist options
  • Save kb10uy/ef953f88a688f67d7326 to your computer and use it in GitHub Desktop.
Save kb10uy/ef953f88a688f67d7326 to your computer and use it in GitHub Desktop.
Kbtter4用のYO返しプラグイン
# coding: utf-8
import clr
from System import *
from System.Collections.Generic import *
from System.Text import *
from System.Text.RegularExpressions import *
from System.IO import *
clr.AddReferenceByPartialName("CoreTweet")
from CoreTweet import *
from CoreTweet.Streaming import *
Name="自分へのリプを含む「YO」発言にYOを返すやつv1.0"
cf="config/yo.txt"
c=1
k=Kbtter4.Instance
if (File.Exists(cf)==False):
File.WriteAllText(cf,"1")
def OnStatus(s):
st=s.Status
if Regex.IsMatch(st.Text,"^(@"+k.AuthenticatedUser.ScreenName+"[\\s ]+)?(YO|yo|Yo)\\s*$") :
c=int.Parse(File.ReadAllText(cf))
prm=Dictionary[String,Object]()
prm["in_reply_to_status_id"]=st.Id
prm["status"]="@"+s.Status.User.ScreenName+" YO("+c.ToString()+"回目)"
k.Token.Statuses.Update(prm)
File.WriteAllText(cf,(c+1).ToString())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment