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

19 lines
508 B
Python

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