|
@@ -1,82 +1,86 @@
|
|
|
# Rollbot
|
|
|
|
|
|
-## Build
|
|
|
+## Running the Project
|
|
|
|
|
|
-`docker build -t rollbot3:latest .`
|
|
|
+Running Rollbot requires either Docker or Python 3.7 to be installed on
|
|
|
+your machine. Additionally, there is some one-time set up, detailed here
|
|
|
|
|
|
-## Deploy
|
|
|
+### One Time Set-Up
|
|
|
|
|
|
-`docker run -p6070:6070 --name rollbot3-instance -d rollbot3`
|
|
|
+Open GroupMe through your preferred application, and create a new
|
|
|
+chat containing just yourself. This will be your testing chat, where your
|
|
|
+local copy of rollbot will post messages. Future plans for the project
|
|
|
+include a simpler local testing environment, but integrating with
|
|
|
+GroupMe is an important testing step regardless, and so it is reasonable
|
|
|
+to do it now anyway.
|
|
|
|
|
|
-## Local Run w/o Docker
|
|
|
-
|
|
|
-`cd` into `src/` and run
|
|
|
-`ROLLBOT_CFG_DIR=../config python3 app.py`
|
|
|
-
|
|
|
-Note this requires at least Python 3.7.1
|
|
|
-
|
|
|
-## Development/Contributing
|
|
|
-
|
|
|
-
|
|
|
-### First Time Set-Up
|
|
|
-If you are developing this project, start by cloning this repository and creating a new branch,
|
|
|
-replacing `my-awesome-branch` with your chosen branch name in the following
|
|
|
-
|
|
|
-```bash
|
|
|
-git clone ssh://git@kirkleon.ddns.net:10022/kirkleon/rollbot3.git
|
|
|
-cd rollbot3/
|
|
|
-git checkout -b feature/my-awesome-branch
|
|
|
-```
|
|
|
-
|
|
|
-Next, open GroupMe through your preferred application, and create a new chat containing just
|
|
|
-yourself. This will be your testing chat, where your local copy of rollbot will post messages.
|
|
|
-Future plans for the project include a simpler local testing environment, but integrating with
|
|
|
-GroupMe is an important testing step regardless, and so it is reasonable to do it now anyway.
|
|
|
-
|
|
|
-Next, create a `secrets.toml` file. Do **NOT** commit this file! It is by default added to `.gitignore`
|
|
|
-for you, but you should always take care you are not accidentally sharing this file.
|
|
|
+Next, create a `config/secrets.toml` file. Do **NOT** commit this file!
|
|
|
+It is by default added to `.gitignore` for you, but you should always take
|
|
|
+care you are not accidentally sharing this file.
|
|
|
|
|
|
```bash
|
|
|
cp config/secrets.toml.template config/secrets.toml
|
|
|
```
|
|
|
-
|
|
|
-Open the new `secrets.toml` file in your preferred editor, and then navigate to the GroupMe
|
|
|
-[Bots](https://dev.groupme.com/bots) page. Then, on the bots page, create a new bot. For this
|
|
|
-bot's group, select the new chat you made above. Name can be whatever you like, and you can
|
|
|
-leave the other fields blank. Click submit, and retrieve your `Bot ID` and `Group ID` from the
|
|
|
-bots page. Put these in your `secrets.toml` under the `groupme_bots` section, with your `Group ID`
|
|
|
-serving as the key and the `Bot ID` serving as the value (which must be in quotes).
|
|
|
-
|
|
|
-For example, if your bot ID is `456`, and your group ID is `789`, your `secrets.toml` needs to
|
|
|
-start with the following
|
|
|
+Open the new `secrets.toml` file in your preferred editor, and then navigate
|
|
|
+to the GroupMe [Bots](https://dev.groupme.com/bots) page. Then, on the bots
|
|
|
+page, create a new bot. For this bot's group, select the new chat you made
|
|
|
+above. Name can be whatever you like, and you can leave the other fields blank.
|
|
|
+Click submit, and retrieve your `Bot ID` and `Group ID` from the bots page. Put
|
|
|
+these in your `secrets.toml` under the `groupme_bots` section, with your
|
|
|
+`Group ID` serving as the key and the `Bot ID` serving as the value (which must
|
|
|
+be in quotes).
|
|
|
+
|
|
|
+For example, if your bot ID is `456`, and your group ID is `789`, your
|
|
|
+`secrets.toml` needs to start with the following
|
|
|
|
|
|
```toml
|
|
|
[groupme_bots]
|
|
|
789 = "456"
|
|
|
```
|
|
|
|
|
|
-That's it for secrets! Save the file and move on to deciding if you want to do your local development
|
|
|
-with or without `docker`.
|
|
|
+That's it for secrets! Note that other plugins may require additional secrets,
|
|
|
+and that image uploads (namely with the `!seychelles` plugin), require an
|
|
|
+imgur client ID as well.
|
|
|
+
|
|
|
+Save the file and move on to deciding if you want to do your local execution
|
|
|
+and/or development with or without `docker`.
|
|
|
|
|
|
-### Developing w/o Docker
|
|
|
+### Build and Deploy w/ Docker
|
|
|
|
|
|
-If you have a Python 3.7.1 environment with `pip` available, you can install dependencies as follows
|
|
|
+Run `./rollbot-docker.sh run` or manually run
|
|
|
|
|
|
```bash
|
|
|
-pip install -r requirements.txt
|
|
|
+docker build -t rollbot3:latest .
|
|
|
+docker run -p6070:6070 --name rollbot3-instance -d rollbot3
|
|
|
```
|
|
|
|
|
|
-If your plugin or extension adds new dependencies, remember to include them in this `requirements.txt`.
|
|
|
+You can run `./rollbot-docker.sh clean` to tear down the container.
|
|
|
|
|
|
-Then, move to the `src/` directory and use the above command to start the local `Flask` server on
|
|
|
-port `6070`.
|
|
|
+### Local Run w/o Docker
|
|
|
+
|
|
|
+This requires Python 3.7 to be installed on your machine. The use of
|
|
|
+a Python virtual environment is recommended, and so you should run the
|
|
|
+following
|
|
|
|
|
|
```bash
|
|
|
-ROLLBOT_CFG_DIR=../config python3 app.py
|
|
|
+python3 -mvenv .venv
|
|
|
+. .venv/bin/activate
|
|
|
+pip install -r requirements.txt
|
|
|
```
|
|
|
|
|
|
-Use `Ctrl-C` to kill this server. Your development loop will probably look something like, modify
|
|
|
-your plugin, start the server, test it, kill the server, repeat.
|
|
|
+To leave the virtual environment, simply run `deactivate`, and when
|
|
|
+you want to run the project again, you need only run `. .venv/bin/activate`.
|
|
|
+
|
|
|
+
|
|
|
+To launch rollbot run `./rollbot-local.sh` or `cd` into `src/`
|
|
|
+and run `ROLLBOT_CFG_DIR=../config python3 app.py`, stopping
|
|
|
+the execution with `Ctrl-C`.
|
|
|
+
|
|
|
+## Development/Contributing
|
|
|
+
|
|
|
+Please keep new plugin branches to the scheme `feature/name-of-plugin`
|
|
|
+where possible. All work *must* be done on either a branch or a fork
|
|
|
+of the repository, and must go through the pull request process.
|
|
|
|
|
|
### Developing w/ Docker
|
|
|
|
|
@@ -186,6 +190,12 @@ TODO
|
|
|
|
|
|
TODO
|
|
|
|
|
|
+ - `msg` is the RollbotMessage triggering the command
|
|
|
+ - `db` is the SQLAlchemy database session scope
|
|
|
+ - `log` is the command's logger
|
|
|
+ - `bot` is the Rollbot instance running the command
|
|
|
+ - `data.*` is supplied the group singleton of the annotated data type
|
|
|
+
|
|
|
#### RollbotResponse
|
|
|
|
|
|
TODO
|