Closes #13
This commit is contained in:
@@ -79,59 +79,18 @@ class PycordGuild(BaseCacheable):
|
||||
|
||||
async def _set(self, cache: Optional[Cache] = None, **kwargs: Any) -> None:
|
||||
await super()._set(cache, **kwargs)
|
||||
# for key, value in kwargs.items():
|
||||
# if not hasattr(self, key):
|
||||
# raise AttributeError()
|
||||
#
|
||||
# setattr(self, key, value)
|
||||
#
|
||||
# await self.__collection__.update_one({"_id": self._id}, {"$set": kwargs})
|
||||
#
|
||||
# self._update_cache(cache)
|
||||
#
|
||||
# logger.info("Set attributes of guild %s to %s", self.id, kwargs)
|
||||
|
||||
async def _remove(self, *args: str, cache: Optional[Cache] = None) -> None:
|
||||
await super()._remove(*args, cache=cache)
|
||||
# attributes: Dict[str, Any] = {}
|
||||
#
|
||||
# for key in args:
|
||||
# if not hasattr(self, key):
|
||||
# raise AttributeError()
|
||||
#
|
||||
# default_value: Any = self.get_default_value(key)
|
||||
#
|
||||
# setattr(self, key, default_value)
|
||||
#
|
||||
# attributes[key] = default_value
|
||||
#
|
||||
# await self.__collection__.update_one({"_id": self._id}, {"$set": attributes})
|
||||
#
|
||||
# self._update_cache(cache)
|
||||
#
|
||||
# logger.info("Reset attributes %s of guild %s to default values", args, self.id)
|
||||
|
||||
def _get_cache_key(self) -> str:
|
||||
return f"{self.__short_name__}_{self.id}"
|
||||
|
||||
def _update_cache(self, cache: Optional[Cache] = None) -> None:
|
||||
super()._update_cache(cache)
|
||||
# if cache is None:
|
||||
# return
|
||||
#
|
||||
# object_dict: Dict[str, Any] = self.to_dict(json_compatible=True)
|
||||
#
|
||||
# if object_dict is not None:
|
||||
# cache.set_json(self._get_cache_key(), object_dict)
|
||||
# else:
|
||||
# self._delete_cache(cache)
|
||||
|
||||
def _delete_cache(self, cache: Optional[Cache] = None) -> None:
|
||||
super()._delete_cache(cache)
|
||||
# if cache is None:
|
||||
# return
|
||||
#
|
||||
# cache.delete(self._get_cache_key())
|
||||
|
||||
@staticmethod
|
||||
def _entry_to_cache(db_entry: Dict[str, Any]) -> Dict[str, Any]:
|
||||
@@ -217,11 +176,6 @@ class PycordGuild(BaseCacheable):
|
||||
await super().reset(*args, cache=cache)
|
||||
|
||||
async def purge(self, cache: Optional[Cache] = None) -> None:
|
||||
"""Completely remove guild data from database. Currently only removes the guild record from guilds collection.
|
||||
|
||||
Args:
|
||||
cache (:obj:`Cache`, optional): Cache engine to write the update into
|
||||
"""
|
||||
await super().purge(cache)
|
||||
|
||||
def is_configured(self) -> bool:
|
||||
|
Reference in New Issue
Block a user