Aller au contenu

bostie.checks

bostie.checks

Per

Per = Literal['user', 'guild', 'channel', 'global'] | Callable[[Any], Hashable]

Cooldown

Cooldown(rate: int, seconds: float, *, per: Per = 'user')

A check that allows rate uses every seconds per user, guild or channel.

rate instance-attribute

rate = rate

seconds instance-attribute

seconds = seconds

per instance-attribute

per: Per = per

ReleasingCheck

Bases: Protocol

A check that holds a slot while the handler runs, freed by release(ctx).

release

release(ctx: AnyContext) -> None

MaxConcurrency

MaxConcurrency(number: int, *, per: Per = 'global')

A check that lets number runs go on at once per user, guild or channel.

number instance-attribute

number = number

per instance-attribute

per: Per = per

release

release(ctx: AnyContext) -> None

End one run that this check let start.

has_permissions

has_permissions(permissions: Permissions) -> Callable[[Any], bool]

A check that the user has permissions in the channel it was used in.

bot_has_permissions

bot_has_permissions(permissions: Permissions) -> Callable[[Any], bool]

A check that the bot has permissions in the channel it was used in.

has_role

has_role(role: int | str) -> Callable[[Any], bool]

A check that the user has role, by id or by name in the cached guild.

has_any_role

has_any_role(*roles: int | str) -> Callable[[Any], bool]

A check that the user has one of roles, each by id or by cached name.

is_owner

is_owner(ctx: AnyContext) -> bool

A check that the user is one of bot.owner_ids.