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
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
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