1 stable release
2.0.0 | Apr 1, 2023 |
---|
#16 in #named-pipe
16KB
112 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-bot
by 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.
- Start the bot by running
piper-bot <TOKEN> <CHANNEL_ID> <PIPE_PATH>
, substituting in the actual values for your arguments. - 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
- Copy the
.env.example
file to.env
and replace the placeholder values with your actual token and channel id. - Create the named pipe at this path inside the project directory:
mnt/pipe
. - Start the bot by running
docker compose up --build -d
.
Dependencies
~12MB
~243K SLoC