I terrify myself
This commit is contained in:
12
main.py
12
main.py
@@ -6,10 +6,10 @@ app = Flask(__name__)
|
|||||||
|
|
||||||
def populate_webhook_lookup():
|
def populate_webhook_lookup():
|
||||||
lookup = {}
|
lookup = {}
|
||||||
with open("./lookup.txt") as file:
|
with open("lookup.txt", "r") as file:
|
||||||
for line in file:
|
for line in file:
|
||||||
split_line = line.split(",")
|
split_line = line.split(",")
|
||||||
lookup[split_line[0]]: split_line[1]
|
lookup[split_line[0]]= split_line[1]
|
||||||
return lookup
|
return lookup
|
||||||
|
|
||||||
UUID_TO_WEBHOOK_LOOKUP = populate_webhook_lookup()
|
UUID_TO_WEBHOOK_LOOKUP = populate_webhook_lookup()
|
||||||
@@ -48,9 +48,10 @@ def home():
|
|||||||
|
|
||||||
@app.route("/hook/<uuid>", methods=["POST"])
|
@app.route("/hook/<uuid>", methods=["POST"])
|
||||||
def convert(uuid):
|
def convert(uuid):
|
||||||
webhook = UUID_TO_WEBHOOK_LOOKUP.get(uuid)
|
lookup = populate_webhook_lookup()
|
||||||
|
webhook = lookup.get(uuid)
|
||||||
|
print(lookup)
|
||||||
ghost_payload = request.get_json()
|
ghost_payload = request.get_json()
|
||||||
print(ghost_payload)
|
|
||||||
discord_payload = convert_ghost_to_discord(ghost_payload)
|
discord_payload = convert_ghost_to_discord(ghost_payload)
|
||||||
|
|
||||||
httpx.post(webhook, data=discord_payload)
|
httpx.post(webhook, data=discord_payload)
|
||||||
@@ -61,6 +62,9 @@ def convert(uuid):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
print("Hello from webhookproxy!")
|
print("Hello from webhookproxy!")
|
||||||
|
with open("lookup.txt", "r") as file:
|
||||||
|
for line in file:
|
||||||
|
print(line.split(','))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user