Skip to content

Instantly share code, notes, and snippets.

@PJB3005
Created October 14, 2016 20:55
Show Gist options
  • Save PJB3005/60b95edbfb297155421bc4a9bafede10 to your computer and use it in GitHub Desktop.
Save PJB3005/60b95edbfb297155421bc4a9bafede10 to your computer and use it in GitHub Desktop.
Discord Relay
#!/usr/bin/env python2
from __future__ import print_function
from flask import Blueprint, request, abort
from multiprocessing.connection import Client
discordrelay = Blueprint("discordrelay", __name__)
@discordrelay.route("/discord")
def relay():
message = {
"id": "nudge",
"pass": request.args["pass"],
"admin": request.args.get("admin", "false") == "true",
"content": request.args["content"],
"ping": request.args.get("ping", "false") == "true"
}
client = Client(("localhost", 1679))
client.send(message)
client.close()
return "Successfully sent the message to MoMMI."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment