Created
March 13, 2014 10:37
-
-
Save kb10uy/9525956 to your computer and use it in GitHub Desktop.
Kbtterで今すぐ使えるスクリプト
This file contains 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: shift-jis | |
import clr | |
from Kbtter import * | |
from System import * | |
from TweetSharp import * | |
from System.Text import * | |
from System.Text.RegularExpressions import * | |
from System.IO import * | |
class change_icon(IKbtterOnTweet,IKbtterOnInitialize): | |
def GetPluginName(self): | |
return "change_icon" | |
def OnInitialize(self,svc,user): | |
st=SendTweetOptions() | |
st.Status="change_iconを開始しました!" | |
#svc.SendTweet(st,DefaultAsyncFunction) | |
def OnTweet(self,svc,user,st): | |
reg=Regex("@"+user.ScreenName+"\\s+change_icon\\s+(?<name>.+)\\s?") | |
m=reg.Match(st.TextDecoded) | |
if m.Success : | |
if (File.Exists("icons/"+m.Groups["name"].Value+".png")==False): | |
ret=SendTweetOptions() | |
ret.Status="@" +st.User.ScreenName+ " " +m.Groups["name"].Value+" というアイコンがありませんでした(´・ω・`)" | |
ret.InReplyToStatusId=st.Id | |
svc.SendTweet(tw,DefaultAsyncFunction) | |
op=UpdateProfileImageOptions() | |
op.ImagePath="icons/"+m.Groups["name"].Value+".png" | |
svc.UpdateProfileImage(op) | |
tw=SendTweetOptions() | |
tw.Status=".@" +st.User.ScreenName+ " アイコンを " +m.Groups["name"].Value+" に変更しましたヾ(๑╹◡╹)ノ" | |
tw.InReplyToStatusId=st.Id | |
print tw.Status | |
svc.SendTweet(tw,DefaultAsyncFunction) | |
fvs=FavoriteTweetOptions() | |
fvs.Id=st.Id | |
svc.FavoriteTweet(fvs,DefaultAsyncFunction) | |
def DefaultAsyncFunction(st,res): | |
return |
This file contains 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: shift-jis | |
import clr | |
clr.AddReferenceByPartialName("WindowsBase") | |
clr.AddReferenceByPartialName("PresentationCore") | |
clr.AddReferenceByPartialName("PresentationFramework") | |
clr.AddReferenceByPartialName("System.Xml") | |
from Kbtter import * | |
from System import * | |
from TweetSharp import * | |
from System.IO import * | |
from System.Xml import * | |
from System.Threading.Tasks import * | |
from System.Windows import * | |
from System.Windows.Controls import * | |
from System.Text import * | |
from System.Text.RegularExpressions import * | |
lfname="nicolist.txt" | |
class nicotweet(IKbtterOnTweet,IKbtterOnInitialize,IKbtterHasSettingWindow): | |
def GetPluginName(self): | |
return "niconicoツイート収集" | |
def OnInitialize(self,svc,user): | |
self.Service=svc | |
self.Me=user | |
if (File.Exists(lfname)==False): | |
File.WriteAllText(lfname,"",Encoding.Unicode) | |
self.nlist=File.ReadAllText(lfname,Encoding.Unicode) | |
def OnTweet(self,svc,user,st): | |
self.nus=user | |
self.status=st | |
pt=Regex("(?<text>.+)\s+\(\d+:\d+\)\s+(https?://[\w/:%#\$&\?\(\)~\.=\+\-]+)\s+#(?<id>(sm)?\d+)") | |
m=pt.Match(st.TextDecoded) | |
if m.Success: | |
text=m.Groups["text"].Value | |
id=m.Groups["id"].Value | |
una=st.User.Name | |
usc=st.User.ScreenName | |
str=String.Format("{0}(@{1})\n{2}\nhttp://www.nicovideo.jp/watch/{3}\n\n",una,usc,text,id) | |
self.nlist+=str | |
File.WriteAllText(lfname,self.nlist,Encoding.Unicode) | |
def GetWindowList(self): | |
listw=KbtterPluginWindow() | |
listw.Title="リスト表示" | |
listw.CreateWindow=self.ListWindow | |
listw.IsModal=False | |
return [listw] | |
def ListWindow(self): | |
w=Window() | |
sp=StackPanel() | |
w.Content=sp | |
w.Title="niconicoツイート取得ツール" | |
lab=Label() | |
lab.Content="今のところ特にこのウィンドウに機能はありません" | |
sp.Children.Add(lab) | |
return w | |
def DefaultAsyncFunction(st,res): | |
return |
This file contains 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: shift-jis | |
import clr | |
from Kbtter import * | |
from System import * | |
from TweetSharp import * | |
from System.Text import * | |
from System.Text.RegularExpressions import * | |
from System.IO import * | |
class scaladescala(IKbtterOnTweet,IKbtterOnInitialize): | |
def GetPluginName(self): | |
return "Scalaですからw" | |
def OnInitialize(self,svc,user): | |
if (File.Exists("scalacounter.txt") == False): | |
File.WriteAllText("scalacounter.txt","1") | |
self.scc=Convert.ToInt32(File.ReadAllText("scalacounter.txt")) | |
st=SendTweetOptions() | |
st.Status="Scalaってスケイラって読むらしいけどそんなことどうでもいいね" | |
#svc.SendTweet(st,DefaultAsyncFunction) | |
def OnTweet(self,svc,user,st): | |
if (st.User==user): | |
return | |
reg=Regex("([Ss]cala)?ですから[ww]*") | |
m=reg.Match(st.TextDecoded) | |
if m.Success : | |
op=SendTweetOptions() | |
op.Status="Scalaですからw("+self.scc.ToString()+"回目)" | |
svc.SendTweet(op,DefaultAsyncFunction) | |
self.scc+=1 | |
File.WriteAllText("scalacounter.txt",self.scc.ToString()) | |
fvs=FavoriteTweetOptions() | |
fvs.Id=st.Id | |
svc.FavoriteTweet(fvs,DefaultAsyncFunction) | |
def DefaultAsyncFunction(st,res): | |
return |
This file contains 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: shift-jis | |
import clr | |
from Kbtter import * | |
from System import * | |
from TweetSharp import * | |
from System.Text import * | |
from System.Text.RegularExpressions import * | |
class update_name(IKbtterOnTweet,IKbtterOnInitialize): | |
def GetPluginName(self): | |
return "update_name" | |
def OnInitialize(self,svc,user): | |
st=SendTweetOptions() | |
st.Status="update_nameを開始しました!" | |
#svc.SendTweet(st,DefaultAsyncFunction) | |
def OnTweet(self,svc,user,st): | |
reg=Regex("@"+user.ScreenName+"\\s+update_name\\s+(?<name>.+)\\s?") | |
m=reg.Match(st.TextDecoded) | |
if m.Success : | |
print "Rename : "+m.Groups["name"].Value | |
op=UpdateProfileOptions() | |
op.Name=m.Groups["name"].Value | |
svc.UpdateProfile(op) | |
tw=SendTweetOptions() | |
tw.Status="@" +st.User.ScreenName+ " " +m.Groups["name"].Value+" に改名しました" | |
tw.InReplyToStatusId=st.Id | |
print tw.Status | |
svc.SendTweet(tw,DefaultAsyncFunction) | |
fvs=FavoriteTweetOptions() | |
fvs.Id=st.Id | |
svc.FavoriteTweet(fvs,DefaultAsyncFunction) | |
def DefaultAsyncFunction(st,res): | |
return |
This file contains 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: shift-jis | |
import clr | |
from Kbtter import * | |
from System import * | |
from TweetSharp import * | |
from System.Text import * | |
from System.Text.RegularExpressions import * | |
class updnfirst(IKbtterOnTweet,IKbtterOnInitialize): | |
def GetPluginName(self): | |
return "ふあすぷupdate_name" | |
def OnInitialize(self,svc,user): | |
st=SendTweetOptions() | |
st.Status="ふあすぷつられ改名サービス開始しました。\nふあすぷさんが改名した時点で私もその名前に改名します。" | |
#svc.SendTweet(st,DefaultAsyncFunction) | |
def OnTweet(self,svc,user,st): | |
if st.User.ScreenName!="firstspring1845": | |
return | |
reg=Regex("(?<scr>@[a-zA-Z0-9_]+) (?<name>.+)に改名しました") | |
m=reg.Match(st.TextDecoded) | |
if m.Success : | |
print "Rename : "+m.Groups["name"].Value | |
op=UpdateProfileOptions() | |
op.Name=m.Groups["name"].Value | |
svc.UpdateProfile(op) | |
tw=SendTweetOptions() | |
tw.Status="ついでに私も " +m.Groups["name"].Value+" に改名しました" | |
print tw.Status | |
svc.SendTweet(tw,DefaultAsyncFunction) | |
fvs=FavoriteTweetOptions() | |
fvs.Id=st.InReplyToStatusId | |
svc.FavoriteTweet(fvs,DefaultAsyncFunction) | |
def DefaultAsyncFunction(st,res): | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment