You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

45 lines
1.3 KiB

import discord_rpc
from settings import *
import logging
file_log = logging.FileHandler('log.log')
console_out = logging.StreamHandler()
logging.basicConfig(format='%(levelname)s:%(name)s -> %(message)s [%(asctime)s]',
handlers=(file_log, console_out))
log = logging.getLogger("drp")
class DRP:
def __init__(self, app_id: (str, int)):
callbacks = {
'ready': self.ready_callback,
'disconnected': self.disconnected_callback,
'error': self.error_callback,
discord_rpc.initialize(app_id, callbacks=callbacks, log=False)
def ready_callback(current_user):
global CURR_USER
CURR_USER = current_user'User -> {}'.format(current_user))
def disconnected_callback(codeno, codemsg):
log.error('Disconnected from Discord rich presence RPC. Code {}: {}'.format(codeno, codemsg))
def error_callback(errno, errmsg):
log.error('An error occurred! Error {}: {}'.format(errno, errmsg))
def update(**kwargs):
def shutdown():