2 stable releases
| 3.0.0 | Sep 30, 2024 |
|---|---|
| 2.0.0 | Apr 1, 2023 |
#1565 in Web programming
61 downloads per month
22KB
298 lines
Piper Bot
Piper Bot is a Discord bot which reads messages in from a named pipe on the host file system, then sends them to a specified Discord channel.
Installation/Usage
- Install
piper-botby runningcargo install --path .in the project directory. - Create a named pipe by running
mkfifo path/to/pipe. - Acquire a Discord bot token and channel id.
- The channel id may be for a guild channel or DM.
- To find the id of a guild channel, enable developer mode in Discord settings, then right click the channel and click "Copy ID".
- To find the id of a DM channel, open Discord in a browser and start a DM with the bot account, then copy the number from the last part of the url.
- Copy the example config file to your user config directory (
cp config.kdl.example ~/.config/piper-bot/config.kdl), and replace the example values. - Start the bot by running
piper-bot. - You can now write a message to the pipe (for example
echo hello > path/to/pipe) and the bot will send the message to Discord.
Running In Docker
- Create a
mntfolder in the project directory. This will be mounted into the container so it can access the config and pipe files. - Create the named pipe inside the
mntfolder (e.g.mnt/pipe). - Copy the
config.kdl.examplefile tomnt/config.kdland replace the example values. Themntfolder is mounted to/mnt, so if your pipe is atmnt/pipethen in the config file you should putfifo "/mnt/pipe". - Start the bot by running
docker compose up --build -d.
Dependencies
~15–29MB
~366K SLoC