Command Line-to-Discord Utility
Lain allows you to post messages to Discord from your Linux command line.
- Download lain.py and sabi.py to the same directory
- Using wget:
- Using curl:
curl https://raw.githubusercontent.com/sabi/sabi/main/sabi.py > sabi.py
curl https://raw.githubusercontent.com/sabi/lain/main/lain.py > lain.py
- Using wget:
- Install Lain
sudo python3 lain.py install
- Creating webhooks is easy on Discord. New webhooks should be added to
/opt/sabi/lain/webhooks.confin the format
channel_nickname = https://discordapp.com/api/123/123
- To create a new webhook in Discord:
- In a channel you have proper permissions, right click a text channel.
- Edit Channel -> Integrations -> Create Webhook
- Copy the webhook URL into
Use from command line
- Lain can be used from the command line. Useful for cron reminders or piping inputs in.
lain channel_nickname -msg your_message
lain system-alerts -msg $hostname rebooted
- Images can be attached to messages by copying them to the images directory at
lain channel_nickname -img your_message
lain motion-cameras -img $(date) Motion captured on front door camera
Use from TUI
- /c /change - Change to a different Discord channel
based off nicknames in webhooks.conf
- /h /help - Display the help screen
- /i /image - Include images in lain/images directory
- /q /quit - Quit the program
- /t /tts - Enable Text-To-Speech for the curent message
/tts This message is being read aloud on your speakers lol
- /v /version - Display version information
- Get Discord notifications instead of emails for cron messages, mdadm alerts, snmp, etc.
- Communicate with a public facing community, like a Twitch streamer community, as an anonymous admin identity and not as individuals.
- Set reminders with cron and lain