PYPRESENCE(1) pypresence PYPRESENCE(1) (NAME) pypresence - pypresence (INSTALLATION) pypresence pip: : pip install pypresence : pip install https://github.com/qwertyquerty/pypresence/archive/master.zip (LINKS) o Discord o Qwerty ( ) o pypresence (INFORMATION) (About) pypresence (wrapper) Discord RPC . Rich Presence Discord . (Quickstart) +---------------------------------------+ | | | | | | | | | | | | | | | | | ( Rich | |Presence). | +---------------------------------------+ Discord RPC . : o . o "Create an Application" . o . o Client ID . o . pypresence . Python 3.9 . : o () . o pip install pypresence Enter . o "Successfully installed pypresence" . Rich Presence . (import) : from pypresence import Presence # The simple rich presence client in pypresence import time Rich Presence . Client ID : client_id = "ID HERE" # Put your Client ID in here RPC = Presence(client_id) # Initialize the Presence client Discord : RPC.connect() # Start the handshake loop Rich Presence . update() . : RPC.update( state="Here it is!", details="A working presence, from python!", name="Rich Presence Example", ) # Updates our presence while . while True: # The presence will stay on as long as the program is running time.sleep(15) # Can only update rich presence every 15 seconds ! [: Finished Presence] [image] Activity Types Status Display Types (enum) ActivityType StatusDisplayType . : from pypresence import Presence from pypresence.types import ActivityType, StatusDisplayType import time client_id = "ID HERE" RPC = Presence(client_id) RPC.connect() # Show as "Listening to" instead of "Playing" RPC.update( activity_type=ActivityType.LISTENING, details="My Favorite Song", state="By My Favorite Artist" ) # Or use StatusDisplayType to control what appears in the user's status RPC.update( status_display_type=StatusDisplayType.STATE, state="Building something awesome", details="Using pypresence" ) while True: time.sleep(15) : PLAYING () LISTENING WATCHING COMPETING : NAME ( - ) STATE DETAILS (URLs) URL . Discord URL : from pypresence import Presence import time client_id = "ID HERE" RPC = Presence(client_id) RPC.connect() # Make state and details clickable RPC.update( state="Playing an Awesome Game", state_url="https://example.com/game", details="In the Main Menu", details_url="https://example.com/game/menu" ) # Make images clickable RPC.update( large_image="game_logo", large_text="My Game", large_url="https://example.com/game", small_image="status_online", small_text="Online", small_url="https://example.com/status" ) while True: time.sleep(15) URL : state_url details_url large_url small_url.SS " (EXAMPLES)" pypresence : Rich Presence : import time from pypresence import Presence client_id = "717091213148160041" # Fake ID, put your real one here RPC = Presence(client_id) # Initialize the client class RPC.connect() # Start the handshake loop print( RPC.update( state="Here it is!", details="A working presence, from python!", name="Rich Presence Example", ) ) # Set the presence while True: # The presence will stay on as long as the program is running time.sleep(15) # Can only update rich presence every 15 seconds Rich Presence (CPU): import time import psutil from pypresence import Presence client_id = "64567352374564" # Fake ID, put your real one here RPC = Presence(client_id, pipe=0) # Initialize the client class RPC.connect() # Start the handshake loop while True: # The presence will stay on as long as the program is running cpu_per = round(psutil.cpu_percent(), 1) # Get CPU Usage mem = psutil.virtual_memory() mem_per = round(psutil.virtual_memory().percent, 1) print( RPC.update( details="RAM: " + str(mem_per) + "%", state="CPU: " + str(cpu_per) + "%" ) ) # Set the presence time.sleep(15) # Can only update rich presence every 15 seconds Rich Presence : import random import time from pypresence import Presence client_id = "64567352374564" # Put your Client ID here, this is a fake ID RPC = Presence(client_id) # Initialize the Presence class RPC.connect() # Start the handshake loop quotes = [ "If you can dream it, you can achieve it.", "Either write something worth reading or do something worth writing.", "You become what you believe.", "Fall seven times and stand up eight.", "The best revenge is massive success.", "Eighty percent of success is showing up.", "Life is what happens to you while you're busy making other plans.", "Strive not to be a success, but rather to be of value.", "The best time to plant a tree was 20 years ago. The second best time is now.", "Everything you've ever wanted is on the other side of fear.", ] # The quotes to choose from while True: # The presence will stay on as long as the program is running RPC.update( details="Famous Quote:", state=random.choice(quotes) ) # Set the presence, picking a random quote time.sleep(60) # Wait a wee bit pypresence (DOCUMENTATION) Presence() class Presence(client_id, pipe=0, loop=None, handler=None) Presence . o client_id (str) -- OAuth2 ( ) o pipe (int) -- Discord . 0 0-9 o loop (asyncio.BaseEventLoop) -- (event loop) ( ) PyPresence . . o handler (function) -- pypresence . coroutine (exception future) . Exception future asyncio.Future connect() - Rich Presence . pypresence.Response clear(pid=os.getpid()) (presence) . pid (int) -- (PID) pypresence.Response close() . pypresence.Response update(**options) (presence) Discord . o pid (int) -- (PID) o activity_type (ActivityType) -- (PLAYING LISTENING WATCHING COMPETING). ActivityType Enum . PLAYING . o status_display_type (StatusDisplayType) -- (NAME STATE DETAILS). StatusDisplayType Enum . NAME . o state (str) -- o state_url (str) -- (URL) state ( state ) o details (str) -- o details_url (str) -- (URL) details ( details ) o name (str) -- Discord o start (int) -- (epoch time) ( ) o end (int) -- (epoch time) ( ).IP o 2 large_image (str) -- o large_text (str) -- (tooltip) o large_url (str) -- (URL) ( ) o small_image (str) -- o small_text (str) -- (tooltip) o small_url (str) -- (URL) ( ) o party_id (str) -- o party_size (list) -- : [1,4] o join (str) -- o spectate (str) -- (spectate) o match (str) -- o buttons (list) -- [{"label": "My Website", "url": "https://qtqt.cf"}, ...] o instance (bool) -- pypresence.Response ActivityType (ActivityType Enum) ActivityType . pypresence.types . : o ActivityType.PLAYING (0) - "Playing {game name}" () o ActivityType.LISTENING (2) - "Listening to {name}" o ActivityType.WATCHING (3) - "Watching {name}" o ActivityType.COMPETING (5) - "Competing in {name}" : from pypresence import Presence from pypresence.types import ActivityType RPC = Presence(client_id) RPC.connect() RPC.update( activity_type=ActivityType.LISTENING, details="My Favorite Song", state="By My Favorite Artist" ) : Discord . (STREAMING) (CUSTOM) Rich Presence . StatusDisplayType (StatusDisplayType Enum) StatusDisplayType . pypresence.types . : o StatusDisplayType.NAME (0) - () o StatusDisplayType.STATE (1) - state o StatusDisplayType.DETAILS (2) - details : from pypresence import Presence from pypresence.types import StatusDisplayType RPC = Presence(client_id) RPC.connect() RPC.update( status_display_type=StatusDisplayType.STATE, state="Custom Status Message", details="What I'm doing" ) Rich Presence . (Clickable URLs) URL (state_url details_url large_url small_url) Rich Presence . Discord . URL : o state_url - state o details_url - details o large_url - o small_url - : state details : from pypresence import Presence RPC = Presence(client_id) RPC.connect() RPC.update( state="Playing an Awesome Game", state_url="https://example.com/game", details="In the Main Menu", details_url="https://example.com/game/menu" ) : : RPC.update( large_image="game_logo", large_text="My Game", large_url="https://example.com/game", small_image="status_icon", small_text="Online", small_url="https://example.com/status" ) : URL : RPC.update( state="Building Something Cool", state_url="https://github.com/username", details="pypresence with URL support", details_url="https://github.com/qwertyquerty/pypresence", large_image="project_logo", large_url="https://project-website.com", buttons=[ {"label": "View Project", "url": "https://github.com/username/project"}, {"label": "Documentation", "url": "https://docs.project.com"} ] ) : o - URL o HTTP/HTTPS o o ( ) class Client(client_id, pipe=0, loop=None, handler=None) RPC . o client_id (str) -- OAuth2 ( ) o pipe (int) -- (Pipe) Discord . 0 0-9 o loop (asyncio.BaseEventLoop) -- (event loop) ( ) PyPresence . . o handler (function) -- (exception handler) pypresence . (exception, future) (coroutine) . Exception future asyncio.Future . start() - RPC . pypresence.Response close() . authorize(client_id, scopes, rpc_token=None, username=None) . (modal) . o client_id (str) -- OAuth2 o scopes (list) -- (scopes) OAuth o rpc_token (str) -- RPC o username (str) -- Discord pypresence.Response (scopes) : authenticate(token) . token (int) -- OAuth2 pypresence.Response get_guilds() (guilds) . pypresence.Response get_channels() . pypresence.Response channel_id() . channel_id (str) -- pypresence.Response set_user_voice_settings(user_id, **options) . o user_id (str) -- o pan_left (float) -- (pan) o pan_right (float) -- (pan) o volume (int) -- ( 100 0 200) o mute (bool) -- (mute) pypresence.Response select_voice_channel(channel_id) . channel_id (str) -- ( None ) pypresence.Response get_selected_voice_channel() . pypresence.Response select_text_channel(channel_id) . channel_id (str) -- ( None ) pypresence.Response set_activity(**options) Discord . . o pid (int) -- (process id) .IP o 2 activity_type (ActivityType) -- (PLAYING LISTENING WATCHING COMPETING). ActivityType Enum <#activity- types> . PLAYING . o status_display_type (StatusDisplayType) -- (NAME STATE DETAILS). StatusDisplayType Enum <#status-display-types> . NAME . o state (str) -- o state_url (str) -- URL state ( state ) o details (str) -- o details_url (str) -- URL details ( details ) o name (str) -- discord o start (int) -- epoch ( ) o end (int) -- epoch ( ) o large_image (str) -- (profile artwork) o large_text (str) -- (tooltip) o large_url (str) -- URL ( ) o small_image (str) -- (profile artwork) o small_text (str) -- (tooltip) o small_url (str) -- URL ( ) o party_id (str) -- (id) o party_size (list) -- : [1,4] o join (str) -- (ask to join) o spectate (str) -- (spectate) o match (str) -- (spectate and join) o buttons (list) -- dict [{"label": "My Website", "url": "https://qtqt.cf"}, ...] o instance (bool) -- (game session) (Return type) pypresence.Response clear_activity(pid=os.getpid()) . (Parameters) pid (int) -- (process id) (Return type) pypresence.Response subscribe(event, args={}) . (Parameters) o event (str) -- o args (dict) -- (Return type) pypresence.Response unsubscribe(event, args={}) . (Parameters) o event (str) -- o args (dict) -- (Return type) pypresence.Response get_voice_settings() . (Return type) pypresence.Response set_voice_settings(**options) . (Parameters) o _input (dict) -- o output (dict) -- o mode (dict) -- o automatic_gain_control (bool) -- (automatic gain control) o echo_cancellation (bool) -- (echo cancellation) o noise_suppression (bool) -- (noise suppression) o qos (bool) -- (QoS) o silence_warning (bool) -- o deaf (bool) -- (self-deafen) o mute (bool) -- (self-mute) (Return type) pypresence.Response capture_shortcut(action) . (Parameters) action (string) -- 'START' 'STOP' (Return type) pypresence.Response send_activity_join_invite(user_id) << >> (Ask to Join) . (Parameters) user_id (str) -- (user id) (Return type) pypresence.Response close_activity_request(user_id) << >> (Ask to Join) . (Parameters) user_id (str) -- (user id) (Return type) pypresence.Response register_event(event, func, args={}) . Discord . . o event (str) -- o func (function) -- o args (dict) -- pypresence.Response unregister_event(event, args={}) . . o event (str) -- o args (dict) -- pypresence.Response (AUTHORS) qwertyquerty, LewdNeko (COPYRIGHT) 2025, qwertyquerty 4.6 July 11, 2026 PYPRESENCE(1)