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

20 lines
508 B
Python
Raw Permalink Normal View History

2024-09-01 12:02:55 +00:00
import discord
from discord import app_commands
from lib.exceptions import BirthdaysDisabled
from services.config_service import GuildConfig
def birthdays_enabled():
2024-09-01 12:02:55 +00:00
async def predicate(interaction: discord.Interaction) -> bool:
if interaction.guild is None:
return True
2024-09-01 12:02:55 +00:00
guild_config = GuildConfig(interaction.guild.id)
if guild_config.birthday_channel_id is None:
raise BirthdaysDisabled
return True
2024-09-01 12:02:55 +00:00
return app_commands.check(predicate)