slord399 / discord_webhook_proxy_original

A Discord webhook proxy, primarily for Roblox games.

Home Page:https://webhook.lewisakura.moe/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebhookProxy

A Discord webhook proxy, primarily for Roblox games.

Why?

Discord banned Roblox from making webhooks again, primarily for abuse purposes. This proxy works around that.

To host it yourself

Basic Setup

This setup just exposes the proxy publicly with no reverse proxy. Recommended to start with only, but you should probably use the correct setup as soon as possible.

  • Install Node.js on your server. This can be done through a package manager or through nvm . The minimum requirement is v16.
  • Install git. This is usually a default tool nowadays, but just grab it off of your package manager if you don’t have it.
  • Install Redis or its Windows equivalent Memurai (please note Memurai is paid software and you should probably just go put Redis in a Docker container instead on Windows, however for testing purposes Memurai will work fine). You need at least v6.2 due to the commands used, though v7 and above is preferable.
  • Install pm2 and yarn (npm i -g pm2 yarn)
  • Run git clone https://github.com/LewisTehMinerz/webhook-proxy to clone the proxy.
  • Enter the resultant webhook-proxy folder.
  • Copy the .example.json files to the same name, just without .example (e.g., config.example.jsonconfig.json).
  • Modify the files as you need, primarily config.json.
  • Run yarn && yarn build. This will install the necessary dependencies and build the project.
  • Run pm2 start dist/index.js --name=webhook-proxy. This will start the app under the name webhook-proxy in pm2.
    • If you wish to run this on startup, run pm2 startup, follow the instructions there, and then run pm2 save.
  • You should be good to go! Future updates just require a simple yarn update.

Correct Setup

This setup involves using a reverse proxy instead of exposing the server directly and using a cluster instead of a single process. This is recommended (and the correct way), but a bit more complicated. This is how I actually run the proxy. This is how I used to run the proxy. I’m now using Cloudflare Tunnel, however this is still the recommended way of doing things that keeps it simple.

  • Install nginx. This will be our front-facing web server.
  • Update your configuration and set trustProxy to true.
  • Create a new site in nginx with the following configuration:
server { listen 80;
<span class="hljs-attribute">server_name</span> &lt;domain name&gt;;

<span class="hljs-section">location</span> / {
    <span class="hljs-attribute">proxy_set_header</span> X-Real-IP <span class="hljs-variable">$remote_addr</span>;
    <span class="hljs-attribute">proxy_set_header</span> X-Forwarded-For <span class="hljs-variable">$proxy_add_x_forwarded_for</span>;
    <span class="hljs-attribute">proxy_set_header</span> X-Forwarded-Proto <span class="hljs-variable">$scheme</span>;
    <span class="hljs-attribute">proxy_set_header</span> Host <span class="hljs-variable">$http_host</span>;
    <span class="hljs-attribute">proxy_set_header</span> X-NginX-Proxy <span class="hljs-literal">true</span>;

    <span class="hljs-attribute">proxy_pass</span> http://127.0.0.1:&lt;port&gt;;
    <span class="hljs-attribute">proxy_redirect</span> <span class="hljs-literal">off</span>;
}

}

(it is recommended you enable SSL and HTTP2 but this is out of scope for this setup)

  • Reload nginx and pm2 restart webhook-proxy. You should be good to go.
  • (Optional) Depending on your load requirements, you may want to cluster WebhookProxy to deal with a large amount of Roblox servers. If you have >50 servers sending webhook requests frequently, you may need to scale. To do so, run pm2 delete webhook-proxy, and then run pm2 start dist/index.js --name=webhook-proxy -i 1. This will run it in a clustered mode instead of the standard fork mode.
    • From here, you can now scale the proxy up and down as you need to by doing pm2 scale webhook-proxy <worker count>. This is good for games that are growing that need to send a lot of webhook requests as you can just put on more workers as needed.
    • Please note that the benefits of clustering come from having multiple CPU cores. If you do not have more than one core on your server, this will not benefit you and will most likely reduce performance from the overhead of clustering and the workers fighting each other for resources.

Enabling Queues

A new feature of the proxy is the queue system. This requires some extra (but simple) setup.

  • Install RabbitMQ 8.
  • Edit your configuration to enable queues, and point to your RabbitMQ installation (it should just be the default value that I’ve provided, but in case you’ve changed anything you can set it here).
  • Restart the proxy (pm2 restart webhook-proxy).
  • Start the queue processor with pm2 start dist/queueProcessor.js --name=webhook-proxy-processor.
    • Run pm2 save as well if necessary.
  • You should be good to go! Try adding /queue onto your webhook requests!

With the newer updates of the proxy, you can now just run yarn update and, as long as you have the setup as described in this guide, it will automatically update the proxy for you. If a yarn update fails, try running it again. It could be that I updated the script.

About

A Discord webhook proxy, primarily for Roblox games.

https://webhook.lewisakura.moe/

License:MIT License


Languages

Language:TypeScript 71.6%Language:HTML 28.4%