How to use the pypresence.exceptions.PyPresenceException function in pypresence

To help you get started, we’ve selected a few pypresence examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qwertyquerty / pypresence / pypresence / exceptions.py View on Github external
class PyPresenceException(Exception):
    def __init__(self, message: str = None):
        if message is None:
            message = 'An error has occured within PyPresence'
        super().__init__(message)


class InvalidID(PyPresenceException):
    def __init__(self):
        super().__init__('Client ID is Invalid')


class InvalidPipe(PyPresenceException):
    def __init__(self):
        super().__init__('Pipe Not Found - Is Discord Running?')


class InvalidArgument(PyPresenceException):
    def __init__(self, expected, received, longdesc: str = None):
        longdesc = '\n{0}'.format(longdesc) if longdesc else ''
        super().__init__('Bad argument passed. Expected {0} but got {1} instead{2}'.format(expected, received, longdesc))


class ServerError(PyPresenceException):
    def __init__(self, message: str):
        super().__init__(message.replace(']', '').replace('[', '').capitalize())


class DiscordError(PyPresenceException):
github qwertyquerty / pypresence / pypresence / exceptions.py View on Github external
super().__init__('Bad argument passed. Expected {0} but got {1} instead{2}'.format(expected, received, longdesc))


class ServerError(PyPresenceException):
    def __init__(self, message: str):
        super().__init__(message.replace(']', '').replace('[', '').capitalize())


class DiscordError(PyPresenceException):
    def __init__(self, code: int, message: str):
        self.code = code
        self.message = message
        super().__init__('Error Code: {0} Message: {1}'.format(code, message))


class ArgumentError(PyPresenceException):
    def __init__(self):
        super().__init__('Supplied function must have one argument.')


class EventNotFound(PyPresenceException):
    def __init__(self, event):
        super().__init__('No event with name {0} exists.'.format(event))
github qwertyquerty / pypresence / pypresence / exceptions.py View on Github external
def __init__(self):
        super().__init__('Client ID is Invalid')


class InvalidPipe(PyPresenceException):
    def __init__(self):
        super().__init__('Pipe Not Found - Is Discord Running?')


class InvalidArgument(PyPresenceException):
    def __init__(self, expected, received, longdesc: str = None):
        longdesc = '\n{0}'.format(longdesc) if longdesc else ''
        super().__init__('Bad argument passed. Expected {0} but got {1} instead{2}'.format(expected, received, longdesc))


class ServerError(PyPresenceException):
    def __init__(self, message: str):
        super().__init__(message.replace(']', '').replace('[', '').capitalize())


class DiscordError(PyPresenceException):
    def __init__(self, code: int, message: str):
        self.code = code
        self.message = message
        super().__init__('Error Code: {0} Message: {1}'.format(code, message))


class ArgumentError(PyPresenceException):
    def __init__(self):
        super().__init__('Supplied function must have one argument.')
github qwertyquerty / pypresence / pypresence / activity.py View on Github external
def started_at(self, seconds_ago: int):
        if seconds_ago < 0 or not isinstance(seconds_ago, int):
            raise PyPresenceException('Must be a positive integer of how many seconds it has been since the start of the activity.')
        self.start = int(time()) - seconds_ago
github qwertyquerty / pypresence / pypresence / exceptions.py View on Github external
super().__init__(message.replace(']', '').replace('[', '').capitalize())


class DiscordError(PyPresenceException):
    def __init__(self, code: int, message: str):
        self.code = code
        self.message = message
        super().__init__('Error Code: {0} Message: {1}'.format(code, message))


class ArgumentError(PyPresenceException):
    def __init__(self):
        super().__init__('Supplied function must have one argument.')


class EventNotFound(PyPresenceException):
    def __init__(self, event):
        super().__init__('No event with name {0} exists.'.format(event))
github qwertyquerty / pypresence / pypresence / exceptions.py View on Github external
if message is None:
            message = 'An error has occured within PyPresence'
        super().__init__(message)


class InvalidID(PyPresenceException):
    def __init__(self):
        super().__init__('Client ID is Invalid')


class InvalidPipe(PyPresenceException):
    def __init__(self):
        super().__init__('Pipe Not Found - Is Discord Running?')


class InvalidArgument(PyPresenceException):
    def __init__(self, expected, received, longdesc: str = None):
        longdesc = '\n{0}'.format(longdesc) if longdesc else ''
        super().__init__('Bad argument passed. Expected {0} but got {1} instead{2}'.format(expected, received, longdesc))


class ServerError(PyPresenceException):
    def __init__(self, message: str):
        super().__init__(message.replace(']', '').replace('[', '').capitalize())


class DiscordError(PyPresenceException):
    def __init__(self, code: int, message: str):
        self.code = code
        self.message = message
        super().__init__('Error Code: {0} Message: {1}'.format(code, message))
github qwertyquerty / pypresence / pypresence / exceptions.py View on Github external
class PyPresenceException(Exception):
    def __init__(self, message: str = None):
        if message is None:
            message = 'An error has occured within PyPresence'
        super().__init__(message)


class InvalidID(PyPresenceException):
    def __init__(self):
        super().__init__('Client ID is Invalid')


class InvalidPipe(PyPresenceException):
    def __init__(self):
        super().__init__('Pipe Not Found - Is Discord Running?')


class InvalidArgument(PyPresenceException):
    def __init__(self, expected, received, longdesc: str = None):
        longdesc = '\n{0}'.format(longdesc) if longdesc else ''
        super().__init__('Bad argument passed. Expected {0} but got {1} instead{2}'.format(expected, received, longdesc))


class ServerError(PyPresenceException):
github qwertyquerty / pypresence / pypresence / activity.py View on Github external
def end_in(self, time_until_end: int):
        if time_until_end < 0 or not isinstance(time_until_end, int):
            raise PyPresenceException('Must be a positive integer of how many seconds the activity will end in.')
        self.end = int(time()) + time_until_end
github qwertyquerty / pypresence / pypresence / exceptions.py View on Github external
def __init__(self):
        super().__init__('Pipe Not Found - Is Discord Running?')


class InvalidArgument(PyPresenceException):
    def __init__(self, expected, received, longdesc: str = None):
        longdesc = '\n{0}'.format(longdesc) if longdesc else ''
        super().__init__('Bad argument passed. Expected {0} but got {1} instead{2}'.format(expected, received, longdesc))


class ServerError(PyPresenceException):
    def __init__(self, message: str):
        super().__init__(message.replace(']', '').replace('[', '').capitalize())


class DiscordError(PyPresenceException):
    def __init__(self, code: int, message: str):
        self.code = code
        self.message = message
        super().__init__('Error Code: {0} Message: {1}'.format(code, message))


class ArgumentError(PyPresenceException):
    def __init__(self):
        super().__init__('Supplied function must have one argument.')


class EventNotFound(PyPresenceException):
    def __init__(self, event):
        super().__init__('No event with name {0} exists.'.format(event))