#discord-bot #named-pipe #send-message #read #channel #system #host

app piper-bot

A bot that reads messages from a named pipe and sends them to Discord

2 stable releases

3.0.0 Sep 30, 2024
2.0.0 Apr 1, 2023

#574 in Web programming

Download history 2/week @ 2024-07-02 118/week @ 2024-09-24 69/week @ 2024-10-01 8/week @ 2024-10-08

195 downloads per month

Unlicense

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-bot by running cargo 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 mnt folder 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 mnt folder (e.g. mnt/pipe).
  • Copy the config.kdl.example file to mnt/config.kdl and replace the example values. The mnt folder is mounted to /mnt, so if your pipe is at mnt/pipe then in the config file you should put fifo "/mnt/pipe".
  • Start the bot by running docker compose up --build -d.

Dependencies

~14–28MB
~366K SLoC