2022-01-09 12:48:37 +08:00
|
|
|
import time
|
|
|
|
|
from multiprocessing import Process
|
|
|
|
|
|
|
|
|
|
from pypresence import Presence
|
|
|
|
|
|
2022-01-10 22:14:25 +08:00
|
|
|
process: Process = None
|
2022-01-09 12:48:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def run():
|
|
|
|
|
APPLICATION_ID = "929437173764223057"
|
|
|
|
|
RPC = Presence(APPLICATION_ID)
|
|
|
|
|
RPC.connect()
|
2022-02-24 22:09:59 +08:00
|
|
|
RPC.update(state="Alas is playing Azurlane", start=time.time(), large_image="alas")
|
2022-01-09 12:48:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def init_discord_rpc():
|
|
|
|
|
global process
|
2022-01-10 22:14:25 +08:00
|
|
|
if process is None:
|
|
|
|
|
process = Process(target=run)
|
|
|
|
|
process.start()
|
2022-01-09 12:48:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def close_discord_rpc():
|
|
|
|
|
global process
|
2022-01-10 22:14:25 +08:00
|
|
|
if process is not None:
|
|
|
|
|
process.terminate()
|
|
|
|
|
process = None
|
2022-01-10 00:42:40 +08:00
|
|
|
|
|
|
|
|
|
2022-02-24 22:09:59 +08:00
|
|
|
if __name__ == "__main__":
|
|
|
|
|
init_discord_rpc()
|