Guild is a Command Line Utility that allows you to post code snippets from a file to a Discord channel.
By utilizing Serentiy to access the Discord API, guild communicates with your Discord server using Webhooks. This allows guild to post a message to Discord on its own without having to type anything into Discord itself.
In order to download guild, you need to have Rust downloaded on your computer if you don't already. To install Rust, go to the Rust website and follow the instructions.
Once Rust is installed on your machine, you must install guild through Cargo:
cargo install guild
- Create a Discord Webhook in the desired server
- Copy the Discord Webhook URL and execute the following command in your terminal
guild set <webhook url>
- Post your desired code snippet to the Discord server:
guild post <file path> <starting line> <ending line>
- If you would like the code snippet to have syntax highlighting, add the following flag at the end of your command:
or
guild post <file path> <starting line> <ending line> -H
guild post <file path> <starting line> <ending line> --highlight
- Example:
guild post main.c 1 5 -H
- If you would like the code snippet to have syntax highlighting, add the following flag at the end of your command:
set
: Set the Discord Webhook URLpost
: Post a code snippet to the set Discord channel
help
: See the possible commands and flags that are supported by guildhighlight
: Enable syntax highlighting for the code snippet