2018-09-09 20:50:53 +02:00
from typing import Tuple
2018-09-09 20:38:57 +02:00
class PluralKitError ( Exception ) :
2018-09-09 20:50:53 +02:00
def __init__ ( self , message ) :
self . message = message
self . help_page = None
def with_help ( self , help_page : Tuple [ str , str ] ) :
self . help_page = help_page
2018-09-09 20:38:57 +02:00
class ExistingSystemError ( PluralKitError ) :
2018-09-09 20:50:53 +02:00
def __init__ ( self ) :
super ( ) . __init__ ( " You already have a system registered. To delete your system, use `pk;system delete`, or to unlink your system from this account, use `pk;system unlink`. " )
2018-09-09 20:38:57 +02:00
class DescriptionTooLongError ( PluralKitError ) :
2018-09-09 20:50:53 +02:00
def __init__ ( self ) :
super ( ) . __init__ ( " You can ' t have a description longer than 1024 characters. " )
2018-09-09 20:38:57 +02:00
class TagTooLongError ( PluralKitError ) :
2018-09-09 20:50:53 +02:00
def __init__ ( self ) :
super ( ) . __init__ ( " You can ' t have a system tag longer than 32 characters. " )
2018-09-09 20:38:57 +02:00
class TagTooLongWithMembersError ( PluralKitError ) :
def __init__ ( self , member_names ) :
2018-09-09 20:50:53 +02:00
super ( ) . __init__ ( " The maximum length of a name plus the system tag is 32 characters. The following members would exceed the limit: {} . Please reduce the length of the tag, or rename the members. " . format ( " , " . join ( member_names ) ) )
2018-09-09 20:38:57 +02:00
self . member_names = member_names
class CustomEmojiError ( PluralKitError ) :
2018-09-09 20:50:53 +02:00
def __init__ ( self ) :
super ( ) . __init__ ( " Due to a Discord limitation, custom emojis aren ' t supported. Please use a standard emoji instead. " )
2018-09-09 20:38:57 +02:00
class InvalidAvatarURLError ( PluralKitError ) :
2018-09-09 20:50:53 +02:00
def __init__ ( self ) :
super ( ) . __init__ ( " Invalid image URL. " )
class AccountInOwnSystemError ( PluralKitError ) :
def __init__ ( self ) :
super ( ) . __init__ ( " That account is already linked to your own system. " )
2018-09-09 20:38:57 +02:00
class AccountAlreadyLinkedError ( PluralKitError ) :
def __init__ ( self , existing_system ) :
2018-09-09 20:50:53 +02:00
super ( ) . __init__ ( " The mentioned account is already linked to a system (` {} `) " . format ( existing_system . hid ) )
2018-09-09 20:38:57 +02:00
self . existing_system = existing_system
class UnlinkingLastAccountError ( PluralKitError ) :
2018-09-09 20:50:53 +02:00
def __init__ ( self ) :
super ( ) . __init__ ( " This is the only account on your system, so you can ' t unlink it. " )