Update README.md
This commit is contained in:
parent
b29ed09f71
commit
9b26aa113b
61
README.md
61
README.md
@ -1,35 +1,52 @@
|
|||||||
GarfBot is a discord bot that uses openai generative pre-trained AI models to produce text and images for your personal entertainment and companionship.
|
Who is GarfBot?
|
||||||
|
======
|
||||||
|
|
||||||
|
GarfBot is a discord bot that uses openai generative pre-trained AI models to produce text and images for your personal entertainment and companionship. There are a few ways you can interact with him on discord, either in a server you've invited him to or by direct message:
|
||||||
|
|
||||||
To interact: (not case-sensitive)
|
`hey garfield {prompt}`
|
||||||
|
Responds with text.
|
||||||
|
|
||||||
`"hey garfield {prompt}"`
|
`garfpic {prompt}`
|
||||||
responds with text.
|
Responds with an image.
|
||||||
|
|
||||||
`"garfpic {prompt}"`
|
`garfping {target}`
|
||||||
responds with image.
|
Responds with iputils-ping result from target.
|
||||||
|
|
||||||
|
`garfpic {target}`
|
||||||
|
Responds with dnsutils lookup result from target.
|
||||||
|
|
||||||
To get started, clone this repo and create a `config.py` file in GarfBot's root directory. Open your favorite text editor or IDE and add your various API tokens as such:
|
`garfpic {target}`
|
||||||
|
Responds with nmap scan result from target.
|
||||||
|
|
||||||
|
`garfshop {item} {zip}`
|
||||||
|
Responds with 10 grocery {item}s from the nearest Kroger location, listed from least to most expensive.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
======
|
||||||
|
|
||||||
|
To get started, `git clone https://git.crate.zip/crate/garfbot.git` and create a `config.py` file in the root directory.
|
||||||
|
Open your favorite text editor and add your various API tokens:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
GARFBOT_TOKEN = "token"
|
GARFBOT_TOKEN = "Discord API token"
|
||||||
OPENAI_TOKEN = "token"
|
OPENAI_TOKEN = "OpenAI API token"
|
||||||
GIF_TOKEN = "token"
|
GIF_TOKEN = "tenor.com API token"
|
||||||
```
|
```
|
||||||
If you want to configure a more secure setup, go ahead.
|
|
||||||
|
|
||||||
Next, I recommend building a docker image for each bot using the included DockerFile as a template. Run each container binding /usr/src/app to GarfBot's CWD.
|
I recommend building a docker image using the included DockerFile as a template. Run the container binding /usr/src/app to GarfBot's CWD:
|
||||||
|
|
||||||
A terraform file has been included to launch all three containers, or you can do it manually.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
```console
|
```console
|
||||||
crate@raspberrypi:~/garfbot $ docker build -t garfbot .
|
crate@raspberrypi:~/garfbot $ docker build -t garfbot .
|
||||||
crate@raspberrypi:~/garfbot $ docker run -d --restart always -v $PWD:/usr/src/app --name garfbot garfbot
|
crate@raspberrypi:~/garfbot $ docker run -d --restart always -v $PWD:/usr/src/app --name garfbot garfbot
|
||||||
```
|
```
|
||||||
|
In case you'd rather not do it manually, a `garfbot.tf` file has been included to launch GarfBot and his friends' containers.
|
||||||
|
|
||||||
Or if you prefer to install dependencies (from requirements.txt) on you own host and run as a systemd service:
|
If you prefer to install dependencies on you own host and run as a systemd service:
|
||||||
|
|
||||||
|
```console
|
||||||
|
crate@raspberrypi:~/garfbot $ sudo nano /etc/systemd/system/garfbot.service
|
||||||
|
```
|
||||||
|
Replace {user} with your username:
|
||||||
```console
|
```console
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=garfbot
|
Description=garfbot
|
||||||
@ -38,10 +55,16 @@ After=multi-user.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
Restart=always
|
Restart=always
|
||||||
User=pi
|
User={user}
|
||||||
WorkingDirectory=/home/crate/garfbot
|
WorkingDirectory=/home/{user}/garfbot
|
||||||
ExecStart=/usr/bin/python ./garfbot.py
|
ExecStart=/usr/bin/python garfbot.py
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
```
|
```
|
||||||
|
And finally:
|
||||||
|
```console
|
||||||
|
crate@raspberrypi:~/garfbot $ sudo systemctl daemon-reload
|
||||||
|
crate@raspberrypi:~/garfbot $ sudo systemctl enable garfbot
|
||||||
|
crate@raspberrypi:~/garfbot $ sudo systemctl start garfbot
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user