diff --git a/classes/errors/wallet.py b/classes/errors/wallet.py index 5593c3b..a461cdb 100644 --- a/classes/errors/wallet.py +++ b/classes/errors/wallet.py @@ -14,9 +14,9 @@ class WalletInsufficientFunds(Exception): """Wallet's balance is not sufficient to perform the operation""" def __init__( - self, - wallet: "Wallet", - amount: float, + self, + wallet: "Wallet", + amount: float, ) -> None: self.wallet = wallet self.amount = amount diff --git a/classes/pycord_guild.py b/classes/pycord_guild.py index 3181227..b0889e6 100644 --- a/classes/pycord_guild.py +++ b/classes/pycord_guild.py @@ -1,3 +1,12 @@ +from dataclasses import dataclass + +from bson import ObjectId + + +@dataclass class PycordGuild: + _id: ObjectId + id: int + def __init__(self) -> None: raise NotImplementedError() diff --git a/classes/wallet.py b/classes/wallet.py index ade5f7e..5e38788 100644 --- a/classes/wallet.py +++ b/classes/wallet.py @@ -26,7 +26,7 @@ class Wallet: # TODO Write a docstring @classmethod async def from_id( - cls, owner_id: int, guild_id: int, allow_creation: bool = True + cls, owner_id: int, guild_id: int, allow_creation: bool = True ) -> "Wallet": db_entry = await col_wallets.find_one( {"owner_id": owner_id, "guild_id": guild_id} @@ -70,7 +70,7 @@ class Wallet: @staticmethod def get_defaults( - owner_id: Optional[int] = None, guild_id: Optional[int] = None + owner_id: Optional[int] = None, guild_id: Optional[int] = None ) -> Dict[str, Any]: return { "owner_id": owner_id, @@ -101,13 +101,13 @@ class Wallet: # TODO Write a docstring async def withdraw( - self, - amount: float, - allow_overdraft: bool = False, - overdraft_limit: Optional[float] = None, + self, + amount: float, + allow_overdraft: bool = False, + overdraft_limit: Optional[float] = None, ) -> None: if amount > self.balance and ( - not allow_overdraft or (allow_overdraft and amount > overdraft_limit) + not allow_overdraft or (allow_overdraft and amount > overdraft_limit) ): raise WalletInsufficientFunds(self, amount)