This is a Node.js server application that helps with sharing media from other websites on Discord. It is intended to be used together with a compatible client, namely:
This server application exists so that client applications may use the provided functionalities without requiring knowledge of some sensitive secrets (Discord webhook URL, Discord bot token, etc.).
As of now this application is only able to share reddit posts in Discord server channels and is only able to do so using a webhook URL. Further features and changes to how this application is used may follow.
- Node.js
- npm or equivalent
- host must have an open HTTP port to receive share commands
Create a .env file in the app's root directory, based on .env.sample, and make the following adjustments:
DISCORD_WEBHOOK_URL= the URL of the Discord webhook for the channel that media should be posted to
Start the app with npm start.
Once it is running, you can prompt it to send Discord messages by sending requests to the REST-API, ideally using a compatible client.
POST /api/share/reddit
JSON-Body:
{
"postUrl":"<postUrl>",
"embedUrls": [
"<embedUrl1>",
"<embedUrl2>"
]
}<postUrl>may be the URL of a subreddit post (i.e.www.reddit.com/r/<subreddit>/comments/<postId>/<postTitle>/) or a user profile post (i.e.www.reddit.com/user/<user>/comments/<postId>/<postTitle>/)embedUrlsis an optional key; if provided, it must be a non-empty array<embedUrlN>may be any URL that should be posted alongside the reddit post URL in order to provide an alternative embed
The application only supports HTTP and not HTTPS. The application does not include any access control mechanisms.
To address the above points, it is recommended to place the server application behind a reverse proxy to allow/force clients to make requests using HTTPS and to limit which clients can make use of the application's functionalities through appropriate access control mechanisms.