discord-interactions.py

time_restricted

Function

Restricts the command to some hours (UTC).

from discord_interactions.slash import time_restricted

Signature

def time_restricted(hours: List[int]) -> Callable

Parameters

NameTypeDefaultDescription
hoursList[int]required

Returns

Callable

Details

Example:

@slash.command()@time_restricted([9, 10, 11, 12, 13, 14, 15, 16, 17])  # 9 AM - 5 PM UTCasync def work_hours_only(ctx): ...

Type a name: create_button, ModalBuilder, cooldown.