alexpaden / ditti-bot

DITTI is a Farcaster bot that serves as a cast line interface (CLI), offering a variety of functions to improve user experience on the Farcaster platform.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DITTI Farcaster Bot: Cast Line Interface

DITTI is a Farcaster bot that serves as a cast line interface (CLI), offering a variety of functions to improve user experience on the Farcaster platform. The bot is written in Python and utilizes the Farcaster-py library, OpenAI GPT, Google Cloud Translate, and Text2Img.

Deploy on Railway

Features

  • Python-based Farcaster bot
  • Utilizes Farcaster-py, OpenAI GPT, Google Cloud Translate, and Text2Img
  • Offers a range of commands for users to interact with

Commands

To use DITTI, simply mention the bot with the desired command:

@ditti <command>

Available Commands

  • @ditti thread - Convert a thread of posts by the same author into an image.
  • @ditti gpt <question> - Create an instance of ChatGPT, subsequent replies do not require the command.
  • ditti gpt* <question> - Creates an instance of ChatGPT and provides and initially long-form response.
  • @ditti gpt^ - Create an instance of ChatGPT using # of thread replies for context, default 1 (i.e. @ditti gpt^4, @ditti gpt*^2)
  • @ditti translate - Translate one cast or thread of foreign language casts by user into English.
  • @ditti hash - Reply to cast with this to get the hash of that cast.
  • @ditti bookmark <title> --tag <name> - Create a bookmark of a cast using a Title description and optional category tag.
  • @ditti cut <title> --tag <name> - Cuts an image from cast and saves it for gallery use with option title and tag.
  • @ditti whois <username, ens, address> - returns a whois for the requested user, ens, or wallet address.
  • @ditti help - Display all commands and information

How to Use

Running Locally


**Requirements:** Python3, Poetry, Docker, Supabase CLI
  1. In the project directory, create a local Supabase instance. This will create all the tables for you: supabase start

  2. Rename .env.example to .env and configure your variables with the credentials generated from the previous step. Your SUPABASE_URL will be the API URL from the terminal output. The Studio URL is not necessary, but you may want to use it to view your database tables: cp .env.example .env

  3. In the project directory, ensure poetry is using python 3.10 with poetry env use 3.10, then run poetry install and poetry run python ditti/core/main.py


Deploying to Production (Railway)

  1. Create an empty Supabase project and connect to the CLI: supabase login supabase link --project-ref <project-id>

  2. Push your database schema: supabase db push

  3. In railway, set environment variables using your .env values, and set the start command to: python -m venv /opt/venv && . /opt/venv/bin/activate && poetry run python ditti/core/main.py


Running Tests

  1. From the main folder, run poetry run python -m pytest tests.
  2. For specific tests, run poetry run python -m pytest tests/test_<module>.py, for example poetry run python -m pytest tests/test_gpt.py.

Contributing

Before submitting a pull request, please ensure your code follows the project's style guidelines by running make codestyle and passes lint checks with make lint.

Codestyle

To enforce consistent code style, we use pyupgrade, isort, and black. You can run the following command to automatically format your code: make codestyle

Linting

We use flake8 and mypy to perform linting and type checking. Run the following command to check your code for issues: make lint

For more information and other useful tools, visit ditti.xyz or contact @ditti on farcaster.

About

DITTI is a Farcaster bot that serves as a cast line interface (CLI), offering a variety of functions to improve user experience on the Farcaster platform.


Languages

Language:Python 99.3%Language:Makefile 0.7%