1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 22:23:13 +00:00
Lumi/lib/exceptions.py

37 lines
945 B
Python
Raw Normal View History

2024-09-01 12:02:55 +00:00
from discord import app_commands
from discord.ext import commands
from lib.const import CONST
2024-09-01 12:02:55 +00:00
class BirthdaysDisabled(commands.CheckFailure, app_commands.CheckFailure):
"""
Raised when the birthdays module is disabled in ctx.guild.
"""
class LumiException(commands.CommandError, app_commands.AppCommandError):
"""
A generic exception to raise for quick error handling.
"""
2024-08-29 08:48:14 +00:00
def __init__(self, message: str = CONST.STRINGS["lumi_exception_generic"]):
self.message = message
super().__init__(message)
def __str__(self) -> str:
return self.message
class Blacklisted(commands.CommandError, app_commands.AppCommandError):
"""
Raised when a user is blacklisted.
"""
2024-08-29 08:48:14 +00:00
def __init__(self, message: str = CONST.STRINGS["lumi_exception_blacklisted"]):
self.message = message
super().__init__(message)
def __str__(self) -> str:
return self.message