Webhook Server Python - Alderon-Games/pot-community-servers GitHub Wiki
[!CAUTION] We have moved our documentation to a new location! Please visit Webhook Development for the most up-to-date information for this page.
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.
-
Install Python 3
-
Run Following commands in command prompt
mkdir WebhookServerDemo
cd WebhookServerDemo
pip install pipenv
pipenv install Flask
pipenv shell
- 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)
- Run
python app.py
- 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"