Raino is a Discord bot that mainly provides some useful functionalities that I was needing for my own server. These functionalities include:
- Image Conversion: Convert images to different formats.
- Chatbot: Talk to Raino and get responses. He's a nice guy.
This project is still very much a work in progress, so expect some bugs and missing features. If you find any, feel free to open an issue or a pull request.
From the media directory, you can find some images to use for the bot's image, so you can get the authentic Raino experience!
To get Raino up and running you need the following:
- Install Dependencies
Raino uses the DiscordGo library for interfacing with Discord's API. It also needs the necessary libraries for image conversion to work.
# Go packages
go mod download && go mod verify
# Webp library for image conversion
sudo apt install libwebp-dev -y
- Discord Bot Token
If you haven't hosted your own discord bot before, you need to set up a discord application from the Discord Developer Portal.
Once you have it created, grab the token from the Bot
section.
Click the Reset Token
for the code to show up. Then Save it somewhere safe.
It will be used in a later step.
- OAuth2 Permissions
Next step is to invite the bot to your server.
Go to the OAuth2
section of your application and select the bot
scope.
Then select the permissions you want the bot to have.
Once finished, copy the generated URL and paste it in your browser. Follow the instructions to add the bot to a server of your choosing.
- Optional: OpenAI API Key
If you want to use the chatbot functionality, you need to get an API key from OpenAI. You can get one by signing up at their website.
Generate a token and add some balance to the account if needed. Save the token, because it will get put into the bot's configuration file.
You can also choose the exact model you want to use for the chatbot functionality.
Just fill the GPT_MODEL
field in the .env
file with the model name. The default
model used, if no model is specified, is gpt-3.5-turbo
.
To run the bot, you need to have Go installed on your machine. If you don't have it,
you can download it from the official website. Or through
the package manager of your system. (e.g. zypper in go go-doc
)
- Clone the repository to your machine. And navigate to the directory.
git clone https://github.com/sakuexe/go-raino.git
cd go-raino
- Add a
.env
file for configuring the bot. You can copy theenv.example
file and fill in the necessary values.
If you are developing this, remember to add the GUILD_ID
for faster iteration.
mv env.example .env
vi .env # remember to fill in the values
- Build the bot and run it.
go build cmd/
./cmd
- Build the Docker image.
docker build -t go-raino .
- Run the Docker container.
docker compose up --build -d
Because the bot was authenticated with OAuth2, it shouldn't need anything else.
You can set up Raino to automatically start at boot by using a raino.service
file.
This file should be placed (or symlinked) to the /etc/systemd/system/
directory.
sudo ln -s $(pwd)/raino.service /etc/systemd/system/
# enable the service to start at boot
sudo systemctl enable raino
# start the service manually
sudo systemctl start raino
# check the status of the service
systemctl status raino
Here are some helpful guides and resources that I used to build the bot. Maybe you can find them useful too!