EasyBotter 非公式wiki

ID別設定

最終更新:

匿名ユーザー

- view
だれでも歓迎! 編集
※wikiの編集が分からなくて、追加してほしい項目がある場合はページ下の「コメント」から誰かに頼んで下さい。

特定のアカウントに対しては、別のリプライパターンを読み込ませたい

EasyBotter.php内
   function makeReplyTweets($replies, $replyFile, $replyPatternFile){
       if(empty($this->_replyPatternData[$replyPatternFile]) && !empty($replyPatternFile)){
           $this->_replyPatternData[$replyPatternFile] = $this->readPatternFile($replyPatternFile);
       }        
(略)
               foreach($this->_replyPatternData[$replyPatternFile] as $pattern => $res){

1.
       if(empty($this->_replyPatternData[$replyPatternFile]) && !empty($replyPatternFile)){
の直後に
$org_repfile = $replyPatternFile; //デフォルトのファイル名を保管
を追記する。

2.
foreach($this->_replyPatternData[$replyPatternFile] as $pattern => $res){

の直前に
//■■特定の人には別パターン■■
$userName = (string)$reply["user"]["screen_name"];
switch(true){
case stristr($userName, "bot")://botと名のつくアカウント名に対して
$replyPatternFile = "bot_pattern.php";//bot_pattern.phpを適用する
$this->_replyPatternData[$replyPatternFile] = $this->readPatternFile($replyPatternFile);
break;
case $userName == "abcd"://abcdというアカウント名に対して
case $userName == "efgh"://efghというアカウント名に対して
$replyPatternFile = "xxx_pattern.php";//xxx_pattern.phpを適用する
$this->_replyPatternData[$replyPatternFile] = $this->readPatternFile($replyPatternFile);
break;
       default://それ以外
       $replyPatternFile = $org_repfile;	//デフォルトのパターンファイル名
}
または
//■■特定の人には別パターン■■
$userName = (string)$reply["user"]["screen_name"];
if(stristr($userName, "bot")){//botと名のつくアカウント名に対して
$replyPatternFile = "bot_pattern.php";//bot_pattern.phpを適用する
$this->_replyPatternData[$replyPatternFile] = $this->readPatternFile($replyPatternFile);
}else if($userName == "abcd" || $userName == "efgh"){
$replyPatternFile = "xxx_pattern.php";//xxx_pattern.phpを適用する
$this->_replyPatternData[$replyPatternFile] = $this->readPatternFile($replyPatternFile);
}else{
       $replyPatternFile = $org_repfile;	//デフォルトのパターンファイル名
}
を追記する。

コメント

  • 作成感謝!! -- 名無しさん (2013-02-17 16:04:35)
  • ID除外の方を書き変えたり思考錯誤していますが上手くいかず…記載があれば助かります; -- 名無しさん (2013-02-21 16:21:23)
  • これは複数人に対して個別のパターンにできるものでしょうかね -- 名無しさん (2013-03-12 02:08:18)
  • 特定のIDに対して特定の月日だけと絞り込むこともできるかな・・・・・・ -- 名無しさん (2013-05-30 17:29:23)
名前:
コメント:

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

目安箱バナー