aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2021-02-14 18:37:05 +0200
committerGravatar mbaruh <[email protected]>2021-02-14 18:37:05 +0200
commit64598b37145cbd2a2ee25008ff6217ee7fe6de03 (patch)
treee33b8a4112687485cb102cf9d91bd03516d07079
parentRemoved cog check, shutdown restricted to admins (diff)
Renamed _defcon_action to _update_threshold and updated docstring
-rw-r--r--bot/exts/moderation/defcon.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bot/exts/moderation/defcon.py b/bot/exts/moderation/defcon.py
index daacf95b7..cdc5ff1b0 100644
--- a/bot/exts/moderation/defcon.py
+++ b/bot/exts/moderation/defcon.py
@@ -159,7 +159,7 @@ class Defcon(Cog):
"""Set how old an account must be to join the server."""
if isinstance(threshold, int):
threshold = relativedelta(days=threshold)
- await self._defcon_action(ctx.author, threshold=threshold, expiry=expiry)
+ await self._update_threshold(ctx.author, threshold=threshold, expiry=expiry)
@defcon_group.command()
@has_any_role(Roles.admins)
@@ -191,8 +191,8 @@ class Defcon(Cog):
asyncio.create_task(self.channel.edit(topic=new_topic))
@redis_cache.atomic_transaction
- async def _defcon_action(self, author: User, threshold: relativedelta, expiry: Optional[Expiry] = None) -> None:
- """Providing a structured way to do a defcon action."""
+ async def _update_threshold(self, author: User, threshold: relativedelta, expiry: Optional[Expiry] = None) -> None:
+ """Update the new threshold in the cog, cache, defcon channel, and logs, and additionally schedule expiry."""
self.threshold = threshold
if threshold == relativedelta(days=0): # If the threshold is 0, we don't need to schedule anything
expiry = None
@@ -228,7 +228,7 @@ class Defcon(Cog):
async def _remove_threshold(self) -> None:
"""Resets the threshold back to 0."""
- await self._defcon_action(self.bot.user, relativedelta(days=0))
+ await self._update_threshold(self.bot.user, relativedelta(days=0))
@staticmethod
def _stringify_relativedelta(delta: relativedelta) -> str: