-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Xp method and permission
- Loading branch information
Showing
4 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import swibots | ||
from typing import Optional | ||
from swibots.api.community.models import Channel | ||
|
||
|
||
class DeductXP: | ||
async def deduct_xp( | ||
self: "swibots.ApiClient", | ||
community_id: str, | ||
user_id: str, | ||
xp: int = 0, | ||
description: Optional[str] = None, | ||
) -> bool: | ||
""" | ||
Deducts XP from a user in a community. | ||
Args: | ||
community_id: The ID of the community. | ||
user_id: The ID of the user. | ||
xp: The amount of XP to deduct. | ||
description: An optional description of the reason for the deduction. | ||
Returns: | ||
True if the deduction was successful, False otherwise. | ||
""" | ||
return await self.community_service.communities.deduct_xp( | ||
community_id, user_id, xp, description | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters