aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-05-31 12:24:29 +0300
committerGravatar ks129 <[email protected]>2020-05-31 12:24:29 +0300
commit4bee4f5e4e5258606da38fedc9026467dac007ae (patch)
tree5b8482ef2b1461c353bdcbcf1991a181c89de4e9
parentFiltering: Refactor bad names checking (diff)
Filtering: Use POSIX instead ISO format to storage alert cooldowns
-rw-r--r--bot/cogs/filtering.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py
index 17113d551..d1abd1193 100644
--- a/bot/cogs/filtering.py
+++ b/bot/cogs/filtering.py
@@ -5,7 +5,6 @@ from datetime import datetime, timedelta
from typing import Optional, Union
import discord.errors
-from dateutil import parser
from dateutil.relativedelta import relativedelta
from discord import Colour, Member, Message, TextChannel
from discord.ext.commands import Cog
@@ -152,7 +151,7 @@ class Filtering(Cog):
if matches:
last_alert = await self.name_alerts.get(msg.author.id)
if last_alert:
- last_alert = parser.isoparse(last_alert)
+ last_alert = datetime.fromtimestamp(last_alert)
if datetime.now() - timedelta(days=3) < last_alert:
return
@@ -170,7 +169,7 @@ class Filtering(Cog):
)
# Update time when alert sent
- await self.name_alerts.set(msg.author.id, datetime.now().isoformat())
+ await self.name_alerts.set(msg.author.id, datetime.now().timestamp())
async def _filter_message(self, msg: Message, delta: Optional[int] = None) -> None:
"""Filter the input message to see if it violates any of our rules, and then respond accordingly."""