diff --git a/README.md b/README.md new file mode 100644 index 0000000..1e145d4 --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# FrugalityBot + +Frugality is a Discord Bot written in Ruby using `discordrb` and PostgreSQL. It's usage is meant to track your own finances. Work in progress. + +## Features +1. Commands are separated into individual files in `src/commands`. This is the only place you'll need to add a new command. +2. Automatically loads and registers new command files on startup. +3. Uses PostgreSQL to store user data. +4. Supports Discord's slash commands. + +## Prerequisites +Before running the bot, ensure you have the following installed on your system: +* **Ruby 3.3** +* **Bundler** +* **PostgreSQL** +* **Git** + +## Installation +1. **Clone the repository:** + ```bash + git clone [https://git.thenight.club/csxkdv/FrugalityBot.git](https://git.thenight.club/csxkdv/FrugalityBot.git) + cd FrugalityBot + ``` + +2. **Configure Bundler locally:** + This ensures gems are installed inside the project folder to avoid permission issues. + ```bash + bundle config set --local path 'vendor/bundle' + ``` + +3. **Install Dependencies:** + ```bash + bundle install + ``` + +## Database Setup +The bot requires a PostgreSQL database. + +1. **Create a database user:** + ```bash + sudo -u postgres createuser -s user + ``` + +2. **Create the database:** + ```bash + createdb database + ``` + **The database name is also specified [here](https://git.thenight.club/csxkdv/FrugalityBot/src/branch/main/src/database.rb). Ensure it's the same as the one you'll use.** + + *Note: The bot will automatically create the necessary tables (like `total_money`) the first time it connects. If you want new tables, update the database file as desired.* + +## Configuration + +1. Create a `.env` file in the root directory: + ```bash + touch .env + ``` + +2. Add your secrets to the `.env` file: + ```env + BOT_TOKEN=your_discord_bot_token_here + ``` + +## Usage +To start the bot, you must use `bundle exec` to load the local dependencies: +```bash +bundle exec ruby main.rb +``` \ No newline at end of file