Last active 1670065460

A webpage for updating my presence while I'm at work showing what I'm up to

discord_presence_working.py Raw
1from pypresence import Presence # https://github.com/qwertyquerty/pypresence
2from flask import *
3from requests import get
4from time import sleep
5
6client_id = "556918123421368329"
7
8RPC = Presence(client_id)
9RPC.connect()
10app = Flask(__name__)
11
12def 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")
17def r_calls():
18 return update_status("Answering calls")
19
20@app.route("/_tickets")
21def r_tickets():
22 return update_status("Answering tickets")
23
24@app.route("/_dev")
25def r_dev():
26 return update_status("some software for once", "Actually developing")
27
28@app.route("/_chatting_to_coworkers")
29def r_chat():
30 return update_status("Putting out fires")
31
32@app.route("/_lunch")
33def r_lunch():
34 return update_status("Out to lunch")
35
36@app.route("/_clear")
37def r_clear():
38 RPC.clear()
39 return redirect(url_for("index"))
40
41@app.route("/")
42def 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
51app.run(port=8081,host="0.0.0.0")