2012/04/06

原稿ヒイロbot EasyBotter.phpスケルトン

素のEasyBotter.phpはちょっと関数の並び方の基準がよく分からなかったので、自分に分かりやすいように並び替えています。ついでに、アクセス権付加の真似事のようなこともしています。元スクリプトはメソッドは全部public扱いだったような?

<?php
class EasyBotter {

/*=========================================== 変数宣言一式 */

/*=========================== コンストラクタ・デストラクタ */

  //コンストラクタ
  public function __construct() {
  }

  //デストラクタ
  public function __destruct() {
  }

/*============================== bot.phpから利用する関数群 */

  //自動フォロー返し
  public function autoFollow(){
  }

  //ランダムにポスト
  //bot.php側で何も指定しなければdata.txtを見に行く
  public function postRandom($datafile = DIALOG_DATA){
  }  
  
  //順番にポスト
  //bot.php側で何も指定しなければdata.txtを見に行く
  public function postRotation($datafile = DIALOG_DATA, $lastPhrase = FALSE){
  }

  //リプライする
  //bot.php側で何も指定しなければDIALOG_REPLY→DIALOG_DATAの順番で見に行く
  public function reply($cron = 2, $replyFile = DIALOG_DATA, $replyPatternFile = DIALOG_REPLY){
  }

/*===================================== プライベート関数群 */
/*------------------------------------- ツイート生成関数群 */

  //通常の発言を作る
  //$file:対象ファイル指定
  //$number:対象ファイル内$number目の行を取得
  private function makeTweet($file, $number = FALSE){
  }

  //キーフレーズ置換で発言を作る
  private function makeSwapKeyPhraseTweet() {
  }

  //キーフレーズを元にした発言を作る
  //$text:キーフレーズ取得対象文字列
  private function makeKeyphraseTweet($text) {
  }

  //ガンダムリストに追加
  private function addMemberToList($user_id) {
  }
  //ガンダムリストから削除
  private function removeMemberFromList($user_id) {
  }

  //リプライを作る
  //$replies:リプライ作成元文字列(配列)
  //$replyFile:対象ランダムファイル
  //$replyPatternFile:対象パターンファイル
  private function makeReplyTweets($replies, $replyFile, $replyPatternFile){
  }
  
  //タイムラインへの反応を作る
  //$timeline:
  //$replyPatternFile:対象パターンファイル
  private function makeReplyTimelineTweets($timeline, $replyPatternFile){
  }

/*------------------------------------- ツイート操作関数群 */

  //タイムラインの最近の呟きからランダムに一つを取得
  private function getRandomTweet(){
  }

  //つぶやきの中から$minute分以内のものと、最後にリプライしたもの以降のものだけを返す
  private function getRecentTweets($response,$minute){
  }

  //必要なつぶやきのみに絞る
  private function selectTweets($response) {
  }

  //リプライ一覧から自分が既に返事したものを除く
  private function removeRepliedTweets($response){
  }

/*----------------------------------- キーワード変換関数群 */

  //文章を変換する
  private function convertText($text, $reply = FALSE){
  }

  //日付・時刻を変換
  private function convertDateAndTime($text) {
  }

  //カウントダウンを変換
  private function convertCountDown($text) {
  }

/*----------------------------------------- HTML出力関数群 */

  //HTML冒頭部分出力
  private function printHeader() {
  }

  //HTML末尾部分出力
  private function printFooter() {
  }

  //結果を表示する
  private function showResult($response) {
  }

/*----------------------------------- 内部データ保存関数群 */

  //リプライツイートIDをログファイルに記録(どこまでリプライしたかを覚えておく)
  private function saveLog() {
  }

  //ログの順番を並び替える(というかたぶん使用した行を最下部に移動するだけ)
  private function rotateData($file) {
  }

/*-------------------------------------- ファイルI/O関数群 */

  //つぶやきデータを読み込む
  private function readDataFile($file) {
  }

  //リプライパターンデータを読み込む
  private function readPatternFile($file) {
  }

/*------------------------------- TwitterAPIアクセス関数群 */

  //基本的なAPIを叩く
  private function _setData($url, $value = array()) {
  }

  private function _getData($url) {
  }

  private function setUpdate($value) {
  }

  private function getFriendsTimeline() {
  }

  private function getReplies($page = false) {
  }

  private function getFriends($id = null) {
  }

  private function getFollowers() {
  }

  private function followUser($screen_name) {
  }

  private function createListMember($list_id, $user_id) {
  }

  private function destroyListMember($list_id, $user_id) {
  }
}

/*=========================================== その他関数群 */

function is_noun($word) {
}

?>