import pypresence import time import win32gui import win32process import psutil import sys import util import requests import time if "join" in sys.argv: print("joining game...") def join(ev): print(ev) rp = pypresence.Client("440289271580983308") rp.start() print(rp.read()) rp.register_event("ACTIVITY_JOIN", join) rp.loop.run_forever() else: while True: try: rp = pypresence.Client("440289271580983308") rp.start() break except: time.sleep(60)
import asyncio import pypresence CLIENT_ID = 555555555555555555 loop = asyncio.get_event_loop() c = pypresence.Client(CLIENT_ID, loop=loop) c.start() # Prompt user for authorization to do stuff with RPC scopes auth = c.authorize(str(CLIENT_ID), ['rpc']) code_grant = auth['data']['code'] ''' Implement the API found here for code/token exchange: https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-exchange-example (NOTE: Redirect URI is needed and should be what's set in your Dev Application's OAuth2 screen) ''' token = exchange_code(code_grant) # Now authenticate with the token we got (Save to skip authorization later) c.authenticate(token['access_token']) def on_new_message(data): print("New message: %s" % data['message']['content']) # Watch for new messages created on channel 444444444444444444 c.register_event('MESSAGE_CREATE', on_new_message, args={'channel_id': '444444444444444444'}) # Find other event types here: https://discord.com/developers/docs/topics/rpc#commands-and-events-rpc-events
import pypresence import time import win32gui import win32process import psutil import sys import util import requests import time from config import * if "join" in sys.argv: print("joining game...") def join(ev): print(ev) rp = pypresence.Client(client_id) rp.start() print(rp.read()) rp.register_event("ACTIVITY_JOIN", join) rp.loop.run_forever() else: while True: try: rp = pypresence.Client(client_id) rp.start() break except: time.sleep(20)
headers=headers) # Proxy server to not leak client secret r.raise_for_status() if (r.status_code != 200 or r.text == "-1"): return -1 return r.text try: memory = gd.memory.get_memory() except RuntimeError: print("Geometry Dash is closed") exit(1) c = pypresence.Client(836272609834434561) c.start() auth = c.authorize(836272609834434561, ["rpc"]) code = exchange_code(auth['data']['code']) if (code == -1): print("Internal Server Error") exit(1) c.authenticate(code) def deafen(): c.set_voice_settings(deaf=True)