Fixed _set() and _remove() methods

This commit is contained in:
2025-04-22 23:28:58 +02:00
parent 5bf1537968
commit 004b5336d8
4 changed files with 30 additions and 34 deletions

View File

@@ -129,14 +129,12 @@ class PycordEvent:
return cls(**db_entry)
# TODO Update the docstring
async def _set(self, cache: Optional[Cache] = None, **kwargs) -> None:
"""Set attribute data and save it into the database.
Args:
key (str): Attribute to change
value (Any): Value to set
cache (:obj:`Cache`, optional): Cache engine to write the update into
**kwargs (str): Mapping of attribute names and respective values to be set
"""
for key, value in kwargs.items():
if not hasattr(self, key):
@@ -150,13 +148,12 @@ class PycordEvent:
logger.info("Set attributes of event %s to %s", self._id, kwargs)
# TODO Update the docstring
async def _remove(self, cache: Optional[Cache] = None, *args: str) -> None:
async def _remove(self, *args: str, cache: Optional[Cache] = None) -> None:
"""Remove attribute data and save it into the database.
Args:
key (str): Attribute to remove
cache (:obj:`Cache`, optional): Cache engine to write the update into
*args (str): List of attributes to remove
"""
attributes: Dict[str, Any] = {}