Skip to content

leelhn2345/turtle-bot

Repository files navigation

Gardener

The backend to digital garden. Repo started out as a virtual turtle pet on telegram.

Documentation will be mostly for the telegram pet bot.

Features

  • reminder
reminder_demo.mp4
  • chatgpt integration
chat_demo.mp4

Usage

Use /help in chat.

When it's not a group chat, such as direct messages to the bot, the bot will reply to every message.

In group chats, use /chat for it to reply to every message. Use /shutup for the bot to stop responding.

Development

Go to http://<address>/<port>/docs for app's Swagger UI.

The default address and port has been configured in base.yaml and local.yaml.

Requirements

  • Reverse Proxy
    • Needed for webhook
    • I chose ngrok because there's no need to setup SSL/TLS.
    • Feel free to use any other reverse proxy.
  • Postgres Db
  • sqlx-cli
    • to run sql migrations
    • cargo install sqlx-cli --no-default-features --features rustls postgres
  • Docker (Optional)

Setup

This outline the steps I took for local development.

Run the reverse proxy and get the public URL. In my case:

ngrok --http domain=xxxx.xxx.xxx.app 8443
# only available ports for webhooks are 80, 88, 443 or 8443

Copy .env.template to .env and fill up the corresponding environment values.

APP_APPLICATION__PUBLIC_URL is the public URL for reverse proxy.

To start DB and trigger sql migrations:

make dev

If there is an error, likely it is caused by migration before database has been fully setup. Just run the command again.

Run the app with:

cargo run

Production

Build

to build app without communicating with database:

cargo sqlx prepare
# or run `make prep`

Migration

To migrate production database:

DATABASE_URL=<connection_string> sqlx migrate run

Prod Env

Default configs are in ./config directory.

For runtime or sensitive environment values, please refer to .env.prod.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages