Last active
August 29, 2015 14:03
-
-
Save kb10uy/ef953f88a688f67d7326 to your computer and use it in GitHub Desktop.
Kbtter4用のYO返しプラグイン
This file contains hidden or 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
# 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