26 lines
1.2 KiB
Markdown
26 lines
1.2 KiB
Markdown
|
# MM Shell bot
|
||
|
|
||
|
POSIX sh script that works with [mm](https://git.lost.host/meutraa/mm) to allow executables to be run directly from Matrix. Makes command based bots extremely easy to create.
|
||
|
|
||
|
Change the config in the script, put any executable in bin, and run main.sh.
|
||
|
|
||
|
***Do not store your password in plaintext in this script! Ensure that no code execution is possible by exposing executables like `bash` or `python`!***
|
||
|
|
||
|
### Example usage
|
||
|
- `\ping -c1 1.1.1.1`
|
||
|
- The script will check $CMDDIR for any executables named `ping`, then execute it with arguments like so:
|
||
|
- `ping -c1 1.1.1.1`
|
||
|
- STDOUT and STDERR are redirected to Matrix when the command finishes executing
|
||
|
- $TIMEOUT in the config is used to determine maximum run time of the executables
|
||
|
|
||
|
### Environment variables
|
||
|
Some environment variables are available to the executables, to provide extra context for custom scripts and executables.
|
||
|
|
||
|
These variables are:
|
||
|
- `ADMIN`: The bot owner, to provide administrative functionality if required
|
||
|
- `FILE`: The absolute file path to the event
|
||
|
- `MESSAGE`: The content of the message
|
||
|
- `ROOMID`: The room ID
|
||
|
- `SENDER`: The event sender
|
||
|
- `INFILE`: The file that will output directly to the matrix room
|