Skip to content

Commit

Permalink
Updated README & .env.example (#805)
Browse files Browse the repository at this point in the history
* update(readme+env): added troubleshooting steps for various potential setup issues

* fix(readme): grammar corrections

---------

Co-authored-by: LunaUrsa <[email protected]>
  • Loading branch information
theimperious1 and LunaUrsa authored Jul 13, 2024
1 parent 0628e22 commit b097724
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ MATRIX_ACCESS_TOKEN = <Optional>
TELEGRAM_TOKEN = <Optional>

# OpenAI
# This key must be set for any AI functions to work.
# If you're not using this specific AI, then random values will work.
OPENAI_API_ORG = <Optional>
OPENAI_API_KEY = <Optional>

# Google Gemini
# This key must be set for any AI functions to work.
# If you're not using this specific AI, then random values will work.
GEMINI_KEY = <Optional>

# Other API Tokens
MOODLE_TOKEN = <Optional> # For Moodle API
GITHUB_TOKEN = <Optional> # For GitHub API
Expand Down
43 changes: 42 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,30 @@ If you wanted to do this in telegram, you would figure out how to take input val
| | | | | | | | | |
+---------+ +------------+ +------------+ +-------------+ +---------+

### Database Development ##
#### Troubleshooting Command Issues ####
**Moderation Tools**:

To use moderation commands in your TripBot instance, you must have the Moderator role on the development server.

If you need this role, please ask Moonbear.

**AI Features**:

To use AI features in your TripBot instance, you need to do a few things.

First, you will need the Developer role on the development server.

Once again, if you need this role, please ask Moonbear.

Second, you must set the OpenAI key/org and the Gemini key in the .env file. If you're using ChatGPT, you will still need the Gemini key set, but it can be a placeholder, e.g "abc". Since the ChatGPT API isn't free, you will need either a ChatGPT Pro subscription or ChatGPT credits to use their API.

Lastly, you'll need to go into a channel and use /ai setup. This is what the Developer role is needed for.

Go into a channel, preferably #bot-spam, and after using /ai setup, accept the ToS in the help tab. Then, add a persona in the persona tab and proceed to the setup tab to finish your setup and select a channel.

That's it. You're done! Your TripBot instance should be able to be pinged for an AI response now.

### Database Development ###

TripBot's database runs on Postgres, which is a relational database, not a JSON file.

Expand All @@ -154,6 +177,24 @@ When these migration files are pushed to production, the database will be update

Prisma documentation is excellent, check out guides like: https://www.prisma.io/docs/concepts/components/prisma-migrate/migrate-development-production


#### Troubleshooting Initial Database Setup Issues ####

If you run into errors about missing tables/columns, you may need to open Dockerfile.tripbot and uncomment "# RUN npx prisma migrate deploy".

If you then encounter an error about not being able to connect to the tripbot_database, try navigating to Containers > tripbot-tripbot in Docker Desktop, then select exec, and enter the above Prisma migration command there.

If you don't use Docker Desktop, then open terminal or Powershell and enter ```docker exec -it tripbot/bin/sh``` to interact with bash and run the above Prisma migration command.

After that, if it works, restart the bot. If this doesn't work, then please contact Moonbear for assistance.

To persist these changes so that you don't have to do it upon every restart, open docker-compose.yml and uncomment these two lines:

volumes:
- ${DOCKERDIR}/appdata/database/data:/var/lib/postgresql/data

Restart the bot and you should be good to go.

#### Postgres ###

```npm run postgres```
Expand Down

0 comments on commit b097724

Please sign in to comment.