Another Discord Webhook Proxy

Another Discord Webhook Proxy

So I used a lot of open source proxies in the past, and now that I have the means to host proxies, I decided I’d open source one of my own :slight_smile:

The code is hosted on glitch and written in python (using flask + flask limiter libraries).
You can copy the code if you want and host it yourself. I’d recommend this if you have the means to pay for a subscription!!!

There is rate limit which rejects a call if it was called in under 2 seconds ago, so if you need to send information in bursts to a single webhook, consider an alternative.

How to use
---------------------------------------------
https://discord.com/api/webhooks/<id>/<str>
Becomes
https://kingermanpublic.xyz/api/webhooks/<id>/<str> /
https://www.kingermanpublic.xyz/api/webhooks/<id>/<str>

please be mindful of others and don’t abuse this proxy :pleading_face:

Source Code
Language: Python
Required Libraries: (use pip3 to install these)
> requests
> flask
> flask-limiter
# Libraries / Modules
from flask import Flask, request
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
import threading
import requests
import json
import logging
import time

# Limits, do no spam this endpoint
app = Flask(__name__)
limiter = Limiter(
  app,
  key_func=get_remote_address,
  default_limits=["5000 per 1 minute"]
)

# turn off logging in output logs (no http post prints)
log = logging.getLogger('werkzeug')
log.disabled = True

# limiter 2, dictionary so that different servers can't spam the same endpoint
internalLimiter = {}
def removeFromLimiter(key):
  if key in internalLimiter.keys():
    internalLimiter.pop(key) # Remove debounce

# Webhook routing api
@app.route("/api/webhooks/<id>/<str>", methods = ["POST"])
def proxy(id, str):
  if (id + "/" + str) in internalLimiter.keys():
    return "Rate limit exceeded", 429
  
  internalLimiter[(id + "/" + str)] = True #debounce
  threading.Timer(2.0, removeFromLimiter, [(id + "/" + str)]).start() # function is called after 2 asynchronously
  
  data = request.get_json(force = True)
  response = requests.post("https://discord.com/api/webhooks/"+id+"/"+str, json = data)
  return "", int(response.status_code)

# Run application
if __name__ == "__main__":
  app.run()

Here’s some other discord proxy related resources:

Proxy - Hyra
Proxy - FitProxy
Proxy - Lewisakura (Also opensource written in javascript)
Proxy + Tutorial - Bloxrank
Tutorial - Discord Embed Tutorial

1 Like

I cannot view the source code, could you please put it on github or make it available to view on Glitch?

Added the source code to the original post (since it’s pretty small), will also create a github repo later today.

Unsure why you can’t see it on glitch, but I’ll try to resolve that :slight_smile:

can it help hazem’s RoCord fixed?