GoldyBot.errors
1import GoldyBot 2from GoldyBot.logging import print_and_log 3 4class GoldyBotError(Exception): 5 """The parent/master class of all the errors in Goldy Bot.""" 6 def __init__(self, error, no_traceback:bool=False): 7 """Raise me! UwU OwO""" 8 super().__init__(error) 9 GoldyBot.logging.log("error", error, no_traceback) 10 11 12 13# Commands 14#------------- 15class GuildNotRegistered(GoldyBotError): 16 """Raised when a member executes a command from a guild that has not been registered.""" 17 pass 18 19class CommandNotAllowedInGuild(GoldyBotError): 20 """Raised when a command that isn't allowed in that guild executes.""" 21 pass 22 23class MemberHasNoPermsForCommand(GoldyBotError): 24 """Raised when a member without the proper roles tries to execute a command.""" 25 pass 26 27class YourNotAuthor(GoldyBotError): 28 """Raised when a different member tries interacting with an author only view from a slash command.""" 29 pass 30 31 32 33# Roles 34#----------- 35class FailedToFindRole(GoldyBotError): 36 """This exception is raised by ``GoldyBot.objects.Role`` when a role can't be found.""" 37 def __init__(self, option_used=None, option_value=None): 38 error = "Failed to find role!" 39 if not option_used == None: 40 error = f"Failed to find role by the {option_used} '{option_value}'." 41 42 super().__init__(error) 43 44 45 46# Members 47#----------- 48class FailedToFindMember(GoldyBotError): 49 """This exception is raised by ``GoldyBot.objects.Member`` when the member can't be found.""" 50 def __init__(self): 51 error = "Failed to find Member! Double check you've entered the id correctly or you've passed the correct object." 52 super().__init__(error) 53 54 55 56# Modules 57#------------ 58class ModuleFailedToLoad(GoldyBotError): 59 def __init__(self, error): 60 super().__init__(error) 61 62class ModuleNotFound(GoldyBotError): 63 def __init__(self, error): 64 super().__init__(error) 65 66# Guilds 67#--------- 68 69# Guild Config 70class FailedToFindGuildRole(GoldyBotError): 71 """Raised when a guild role can't be found by ``GoldyBot.objects.Role``.""" 72 def __init__(self, error): 73 super().__init__(error, no_traceback=True) 74 75 76 77# Config 78#--------- 79 80# Config Incorrect 81class ConfigIsIncorrect(GoldyBotError): 82 """Error that is raised whenever a configuration file is incorrect or missing something.""" 83 def __init__(self, error, what_is_incorrect:str=None): 84 super().__init__(error) 85 print_and_log("info", "^ This usually means you misspelt something in the config or the layout of the config is incorrect. ^") 86 87 if not what_is_incorrect == None: 88 print_and_log("warn", f"We actually think you might of misspelt '{what_is_incorrect}'.")
5class GoldyBotError(Exception): 6 """The parent/master class of all the errors in Goldy Bot.""" 7 def __init__(self, error, no_traceback:bool=False): 8 """Raise me! UwU OwO""" 9 super().__init__(error) 10 GoldyBot.logging.log("error", error, no_traceback)
The parent/master class of all the errors in Goldy Bot.
7 def __init__(self, error, no_traceback:bool=False): 8 """Raise me! UwU OwO""" 9 super().__init__(error) 10 GoldyBot.logging.log("error", error, no_traceback)
Raise me! UwU OwO
Inherited Members
- builtins.BaseException
- with_traceback
- args
16class GuildNotRegistered(GoldyBotError): 17 """Raised when a member executes a command from a guild that has not been registered.""" 18 pass
Raised when a member executes a command from a guild that has not been registered.
Inherited Members
- builtins.BaseException
- with_traceback
- args
20class CommandNotAllowedInGuild(GoldyBotError): 21 """Raised when a command that isn't allowed in that guild executes.""" 22 pass
Raised when a command that isn't allowed in that guild executes.
Inherited Members
- builtins.BaseException
- with_traceback
- args
24class MemberHasNoPermsForCommand(GoldyBotError): 25 """Raised when a member without the proper roles tries to execute a command.""" 26 pass
Raised when a member without the proper roles tries to execute a command.
Inherited Members
- builtins.BaseException
- with_traceback
- args
28class YourNotAuthor(GoldyBotError): 29 """Raised when a different member tries interacting with an author only view from a slash command.""" 30 pass
Raised when a different member tries interacting with an author only view from a slash command.
Inherited Members
- builtins.BaseException
- with_traceback
- args
36class FailedToFindRole(GoldyBotError): 37 """This exception is raised by ``GoldyBot.objects.Role`` when a role can't be found.""" 38 def __init__(self, option_used=None, option_value=None): 39 error = "Failed to find role!" 40 if not option_used == None: 41 error = f"Failed to find role by the {option_used} '{option_value}'." 42 43 super().__init__(error)
This exception is raised by GoldyBot.objects.Role
when a role can't be found.
38 def __init__(self, option_used=None, option_value=None): 39 error = "Failed to find role!" 40 if not option_used == None: 41 error = f"Failed to find role by the {option_used} '{option_value}'." 42 43 super().__init__(error)
Raise me! UwU OwO
Inherited Members
- builtins.BaseException
- with_traceback
- args
49class FailedToFindMember(GoldyBotError): 50 """This exception is raised by ``GoldyBot.objects.Member`` when the member can't be found.""" 51 def __init__(self): 52 error = "Failed to find Member! Double check you've entered the id correctly or you've passed the correct object." 53 super().__init__(error)
This exception is raised by GoldyBot.objects.Member
when the member can't be found.
51 def __init__(self): 52 error = "Failed to find Member! Double check you've entered the id correctly or you've passed the correct object." 53 super().__init__(error)
Raise me! UwU OwO
Inherited Members
- builtins.BaseException
- with_traceback
- args
The parent/master class of all the errors in Goldy Bot.
Inherited Members
- builtins.BaseException
- with_traceback
- args
The parent/master class of all the errors in Goldy Bot.
Inherited Members
- builtins.BaseException
- with_traceback
- args
71class FailedToFindGuildRole(GoldyBotError): 72 """Raised when a guild role can't be found by ``GoldyBot.objects.Role``.""" 73 def __init__(self, error): 74 super().__init__(error, no_traceback=True)
Raised when a guild role can't be found by GoldyBot.objects.Role
.
Inherited Members
- builtins.BaseException
- with_traceback
- args
82class ConfigIsIncorrect(GoldyBotError): 83 """Error that is raised whenever a configuration file is incorrect or missing something.""" 84 def __init__(self, error, what_is_incorrect:str=None): 85 super().__init__(error) 86 print_and_log("info", "^ This usually means you misspelt something in the config or the layout of the config is incorrect. ^") 87 88 if not what_is_incorrect == None: 89 print_and_log("warn", f"We actually think you might of misspelt '{what_is_incorrect}'.")
Error that is raised whenever a configuration file is incorrect or missing something.
84 def __init__(self, error, what_is_incorrect:str=None): 85 super().__init__(error) 86 print_and_log("info", "^ This usually means you misspelt something in the config or the layout of the config is incorrect. ^") 87 88 if not what_is_incorrect == None: 89 print_and_log("warn", f"We actually think you might of misspelt '{what_is_incorrect}'.")
Raise me! UwU OwO
Inherited Members
- builtins.BaseException
- with_traceback
- args