Checks¶
There are a few built in checks that you can make use of:
is_owner ¶
Requires the sender owns the bot ([NioBot.owner_id][]
), or is in extra_owner_ids
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
extra_owner_ids
|
A set of |
()
|
Returns:
Type | Description |
---|---|
True - the check passed. |
Raises:
Type | Description |
---|---|
NotOwner
|
The sender is not the owner of the bot and is not in the given IDs. |
is_dm ¶
is_dm(allow_dual_membership: bool = False)
Requires that the current room is a DM with the sender.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
allow_dual_membership
|
bool
|
Whether to allow regular rooms, but only with the client and sender as members. |
False
|
Returns:
Type | Description |
---|---|
|
sender_has_power ¶
Requires that the sender has a certain power level in the current room before running the command.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
level
|
int
|
The minimum power level |
required |
room_creator_bypass
|
bool
|
If the room creator should bypass the check and always be allowed, regardless of level. |
False
|
Returns:
Type | Description |
---|---|
|