discord_presence_working.py
· 1.3 KiB · Python
Raw
from pypresence import Presence # https://github.com/qwertyquerty/pypresence
from flask import *
from requests import get
from time import sleep
client_id = "556918123421368329"
RPC = Presence(client_id)
RPC.connect()
app = Flask(__name__)
def update_status(text, d=""):
RPC.update(state=text, details=d if d else None, large_image="desk")
return redirect(url_for("index"))
@app.route("/_calls")
def r_calls():
return update_status("Answering calls")
@app.route("/_tickets")
def r_tickets():
return update_status("Answering tickets")
@app.route("/_dev")
def r_dev():
return update_status("some software for once", "Actually developing")
@app.route("/_chatting_to_coworkers")
def r_chat():
return update_status("Putting out fires")
@app.route("/_lunch")
def r_lunch():
return update_status("Out to lunch")
@app.route("/_clear")
def r_clear():
RPC.clear()
return redirect(url_for("index"))
@app.route("/")
def index():
return """
<a href="/_calls">Answering calls</a><br>
<a href="/_tickets">Answering tickets</a><br>
<a href="/_dev">Actually developing some software for once</a><br>
<a href="/_chatting_to_coworkers">Chatting</a><br>
<a href="/_lunch">Lunch</a><br>
<a href="/_clear">Clear</a><br>"""
app.run(port=8081,host="0.0.0.0")
| 1 | from pypresence import Presence # https://github.com/qwertyquerty/pypresence |
| 2 | from flask import * |
| 3 | from requests import get |
| 4 | from time import sleep |
| 5 | |
| 6 | client_id = "556918123421368329" |
| 7 | |
| 8 | RPC = Presence(client_id) |
| 9 | RPC.connect() |
| 10 | app = Flask(__name__) |
| 11 | |
| 12 | def update_status(text, d=""): |
| 13 | RPC.update(state=text, details=d if d else None, large_image="desk") |
| 14 | return redirect(url_for("index")) |
| 15 | |
| 16 | @app.route("/_calls") |
| 17 | def r_calls(): |
| 18 | return update_status("Answering calls") |
| 19 | |
| 20 | @app.route("/_tickets") |
| 21 | def r_tickets(): |
| 22 | return update_status("Answering tickets") |
| 23 | |
| 24 | @app.route("/_dev") |
| 25 | def r_dev(): |
| 26 | return update_status("some software for once", "Actually developing") |
| 27 | |
| 28 | @app.route("/_chatting_to_coworkers") |
| 29 | def r_chat(): |
| 30 | return update_status("Putting out fires") |
| 31 | |
| 32 | @app.route("/_lunch") |
| 33 | def r_lunch(): |
| 34 | return update_status("Out to lunch") |
| 35 | |
| 36 | @app.route("/_clear") |
| 37 | def r_clear(): |
| 38 | RPC.clear() |
| 39 | return redirect(url_for("index")) |
| 40 | |
| 41 | @app.route("/") |
| 42 | def index(): |
| 43 | return """ |
| 44 | <a href="/_calls">Answering calls</a><br> |
| 45 | <a href="/_tickets">Answering tickets</a><br> |
| 46 | <a href="/_dev">Actually developing some software for once</a><br> |
| 47 | <a href="/_chatting_to_coworkers">Chatting</a><br> |
| 48 | <a href="/_lunch">Lunch</a><br> |
| 49 | <a href="/_clear">Clear</a><br>""" |
| 50 | |
| 51 | app.run(port=8081,host="0.0.0.0") |