2024-09-01 12:02:55 +00:00
|
|
|
import discord
|
|
|
|
from discord import app_commands
|
2024-08-31 21:04:37 +00:00
|
|
|
|
|
|
|
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:
|
2024-08-31 21:04:37 +00:00
|
|
|
return True
|
|
|
|
|
2024-09-01 12:02:55 +00:00
|
|
|
guild_config = GuildConfig(interaction.guild.id)
|
|
|
|
if guild_config.birthday_channel_id is None:
|
2024-08-31 21:04:37 +00:00
|
|
|
raise BirthdaysDisabled
|
|
|
|
|
|
|
|
return True
|
|
|
|
|
2024-09-01 12:02:55 +00:00
|
|
|
return app_commands.check(predicate)
|