2024-10-21 16:40:51 +00:00
Who is GarfBot?
======
2024-10-25 16:13:34 +00:00
![garfield ](https://www.crate.zip/garfield.png )
2023-11-20 02:53:41 +00:00
2024-10-25 16:13:34 +00:00
GarfBot is a discord bot that uses OpenAI's generative pre-trained 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 public server or by direct message:
2023-11-17 19:37:51 +00:00
2024-10-21 16:40:51 +00:00
`hey garfield {prompt}`
Responds with text.
2023-11-17 19:37:51 +00:00
2024-10-21 16:40:51 +00:00
`garfpic {prompt}`
Responds with an image.
2023-11-17 19:37:51 +00:00
2024-10-21 16:40:51 +00:00
`garfping {target}`
Responds with iputils-ping result from target.
2023-11-17 19:37:51 +00:00
2024-10-21 16:40:51 +00:00
`garfpic {target}`
2024-10-25 16:13:34 +00:00
Responds with dns lookup result from target.
2023-11-20 02:53:41 +00:00
2024-12-28 05:08:50 +00:00
`garfhack {target}`
2024-10-21 16:40:51 +00:00
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
======
2024-10-25 16:13:34 +00:00
To get started, clone this repo and create a config file.
```console
$ git clone https://git.crate.zip/crate/garfbot.git & & cd garfbot/ & & nano config.py
```
Add your various API tokens:
2023-11-17 19:37:51 +00:00
```python
2024-10-21 16:40:51 +00:00
GARFBOT_TOKEN = "Discord API token"
OPENAI_TOKEN = "OpenAI API token"
GIF_TOKEN = "tenor.com API token"
2023-11-17 19:37:51 +00:00
```
2023-11-20 02:53:41 +00:00
2024-10-21 16:40:51 +00:00
I recommend building a docker image using the included DockerFile as a template. Run the container binding /usr/src/app to GarfBot's CWD:
2023-11-17 22:04:50 +00:00
```console
2024-10-25 16:13:34 +00:00
$ docker build -t garfbot .
$ docker run -d --restart always -v $PWD:/usr/src/app --name garfbot garfbot
2023-11-17 23:59:34 +00:00
```
2024-10-25 16:13:34 +00:00
2024-10-21 16:40:51 +00:00
In case you'd rather not do it manually, a `garfbot.tf` file has been included to launch GarfBot and his friends' containers.
2023-11-17 23:59:34 +00:00
2024-10-21 16:40:51 +00:00
If you prefer to install dependencies on you own host and run as a systemd service:
```console
2024-10-25 16:13:34 +00:00
$ sudo nano /etc/systemd/system/garfbot.service
2024-10-21 16:40:51 +00:00
```
2024-10-25 16:13:34 +00:00
2024-10-21 16:40:51 +00:00
Replace {user} with your username:
2024-10-25 16:13:34 +00:00
2023-11-17 23:59:34 +00:00
```console
[Unit]
Description=garfbot
After=multi-user.target
[Service]
Type=simple
Restart=always
2024-10-21 16:40:51 +00:00
User={user}
WorkingDirectory=/home/{user}/garfbot
ExecStart=/usr/bin/python garfbot.py
2023-11-17 23:59:34 +00:00
[Install]
WantedBy=multi-user.target
2023-11-20 02:32:05 +00:00
```
2024-10-25 16:13:34 +00:00
2024-10-21 16:40:51 +00:00
And finally:
2024-10-25 16:13:34 +00:00
2024-10-21 16:40:51 +00:00
```console
2024-10-25 16:13:34 +00:00
$ sudo systemctl daemon-reload
$ sudo systemctl enable garfbot
$ sudo systemctl start garfbot
2024-10-21 16:40:51 +00:00
```