Alfred is an extensible Discord bot that can use ChatGPT to respond conversationally and run commands on behalf of the server users.
- Create a Discord App and get the token.
Important
For conversational chat support you will need to give the priviledged intents for messages and presence.
- Get your Discord server ID
Note
Not supplying this will cause commands to be registered as global and they may take up to an hour to become available.
- Get an OpenAI API key
Warning
Not supplying this will prevent Alfred from responding conversationally and only slash commands will be available.
The easiest way to install the bot is to run the guided installation script.
curl -sSL https://raw.githubusercontent.com/dangle/alfred/main/install.sh | sudo bash
Warning
Always verify the contents of any code from the internet before running it.
- Create a folder to store your configuration.
mkdir -p /opt/alfred
cd /opt/alfred
- Download the
docker-compose.yml
file from the repository.
curl -O https://raw.githubusercontent.com/dangle/alfred/main/docker-compose.yml
- Create a
.env
file with the following variables:
DISCORD_TOKEN="discord token"
DISCORD_GUILD_IDS="Discord server ID"
OPENAI_API_KEY"OpenAI API key"
- Start the service
docker-compose up
- Fork the repository
- Clone your fork locally
- Use the devcontainer.
- If you use VS Code it will prompt you to open the project in the devcontainer once you open the folder.
- If you prefer not to use VS Code, you can use the devcontainer-cli to run the devcontainer.
- Verify your changes using
pdm start
. - Once you are ready to submit a pull request, run
pdm check
to ensure your changes can be merged successfully.