Utility functions
ballsdex.core.utils.utils
inventory_privacy
inventory_privacy(bot: BallsDexBot, interaction: Interaction[BallsDexBot], player: Player, user_obj: User | Member)
Check if the inventory of a user is viewable in the given context. If not, a followup response will be sent with a proper message.
Parameters:
-
bot
(BallsDexBot
) –Bot object
-
interaction
(Interaction[BallsDexBot]
) –Interaction of the command.
-
player
(Player
) –Ballsdex Player object of the user whose inventory is being inspected.
-
user_obj
(User | Member
) –Discord user object of the user whose inventory is being inspected.
Returns:
-
bool
–True
if the inventory can be viewed, elseFalse
. If this isFalse
, you should exit the command.
Source code in ballsdex/core/utils/utils.py
is_staff
is_staff(interaction: Interaction[BallsDexBot]) -> bool
Checks if an interacting user checks one of the following conditions:
- The user is a bot owner
- The user has a role considered root or admin
Parameters:
-
interaction
(Interaction[BallsDexBot]
) –The interaction of the user to check.
Returns:
-
bool
–True
if the user is a staff,False
otherwise.