Utility functions
ballsdex.core.utils.utils
can_mention
can_mention(players: list[Player]) -> AllowedMentions
Source code in ballsdex/core/utils/utils.py
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–
Source code in ballsdex/core/utils/utils.py
is_staff
is_staff(interaction: Interaction[BallsDexBot], *perms: str) -> 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.
-
perms(str, default:()) –Django permissions to verify. If empty, only staff status will be checked.
Returns:
-
bool–