discord-interactions.py

check

Function

Adds a custom async check (interaction) -> bool.

from discord_interactions import check

Signature

def check(check_func: Callable[[discord.Interaction], Awaitable[bool]]) -> Callable

Parameters

NameTypeDefaultDescription
check_funcCallable[[discord.Interaction], Awaitable[bool]]required

Returns

Callable

Details

Example:

async def is_premium(interaction):    return await check_premium_status(interaction.user.id) @slash.command()@check(is_premium)async def premium_feature(ctx): ...

Type a name: create_button, ModalBuilder, cooldown.