Webhook Server Python - Alderon-Games/pot-community-servers GitHub Wiki

This tutorial is for advanced users who are writing discord bots and services in Python and would like a way to access the Webhook data to re-format and display in discord and do various other actions with the server.

  1. Install Python 3

  2. Run Following commands in command prompt

mkdir WebhookServerDemo
cd WebhookServerDemo
pip install pipenv
pipenv install Flask
pipenv shell
  1. Create app.py in the WebhookServerDemo folder
from flask import Flask, request
app = Flask(__name__)

@app.route('/pot/login', methods=['POST'])
def login():
    request_data = request.get_json()

    ServerName = request_data['ServerName']
    PlayerName = request_data['PlayerName']
    AlderonId = request_data['AlderonId']
    BattlEyeGUID = request_data['BattlEyeGUID']
    bServerAdmin = request_data['bServerAdmin']
    
if __name__ == '__main__':
    # run app in debug mode on port 80
    app.run(debug=True, port=80)
  1. Run
python app.py
  1. Setup In-game Webhook Event (Game.ini)
[ServerWebhooks]
bEnabled=true
Format="General"
; Replace the below IP with the final IP of your web service.
PlayerLogin="http://127.0.0.1:80/pot/login"