- python のインストール
$ sudo yum install python3 -y
- pip のインストール(参考)
$ curl -O https://bootstrap.pypa.io/get-pip.py
$ python3 get-pip.py --user
- パッケージをインストール
$ pip3 install openai tweepy python-dotenv retrying
- git のインストール
$ sido yum install git -y
- git のユーザー設定
$ git config --global user.name "【アカウント名】"
$ git config --global user.email "【メールアドレス】"
- git clone & pull
$ git clone https://github.com/ibis7895123/chatgpt_reply_bot.git
.env
の配置chatgpt_prompt.txt
の配置- バックグラウンドで起動
# 自前でログを出すので nohup のログを出力しない
$ nohup python3 main.py >/dev/null 2>&1 &
- そのアカウントの access_token / secret を取得する必要がある
- 以下コマンドで取得する
$ pip3 install twitter
$ python3 auth.py
$ ps ux
chatgpt_utils.py
のtext
に質問を入れてコマンド
$ python3 chatgpt_utils.py
- 鍵アカウントは
/2/tweets/search/stream
では取得できないっぽい - やろうと思ったら v1.1 の検索api を使って自分で polling しないといけないかも