n3d1117 / mastofact

🐘 A silly ChatGPT-powered Mastodon bot that posts a random fact every hour

Home Page:https://edoardo.fyi/blog/2023/03/mastodon-chatgpt-bot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mastofact

python-version openai-version mastodon.py-version license

A silly ChatGPT-powered Mastodon bot that toots a random fact every hour. Running at @mastofact

Prerequisites

  • Python 3.10+ and Pipenv
  • A Mastodon access token (create one under Development > Your applications > New application > Your access token)
  • An OpenAI account (see configuration section)

Getting started

Configuration

Customize the configuration by copying .env.example and renaming it to .env, then editing the parameters as desired:

MASTODON_INSTANCE="YOUR_MASTODON_INSTANCE" # e.g. https://mastodon.social/
MASTODON_BOT_TOKEN="YOUR_MASTODON_BOT_TOKEN"
OPENAI_API_KEY="YOUR_OPENAI_API_KEY"

# Optional parameters
POST_INTERVAL_SECONDS=3600 # Defaults to 3600 (1h)

Installing

  1. Clone the repository and navigate to the project directory:
git clone https://github.com/n3d1117/mastofact.git
cd mastofact

From Source

  1. Create a new virtual environment with Pipenv and install the required dependencies:
pipenv install
  1. Activate the virtual environment:
pipenv shell
  1. Use the following command to start the bot:
python bot.py

Using Docker Compose

  1. Run the following command to build and run the Docker image:
docker-compose up

Credits

Disclaimer

This is a personal project and is not affiliated with OpenAI in any way.

License

MIT license. For more information, see the LICENSE file included in the repository.

About

🐘 A silly ChatGPT-powered Mastodon bot that posts a random fact every hour

https://edoardo.fyi/blog/2023/03/mastodon-chatgpt-bot/

License:MIT License


Languages

Language:Python 89.4%Language:Dockerfile 10.6%