Last active 1670065460

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

S Smith revised this gist 1552851482. Go to revision

1 file changed, 51 insertions

discord_presence_working.py(file created)

@@ -0,0 +1,51 @@
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")
Newer Older