aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joseph Banks <[email protected]>2020-06-17 21:20:27 +0100
committerGravatar Joseph Banks <[email protected]>2020-06-17 21:20:27 +0100
commit47b6f65e231305c2ceb4f48a2a772a734ae190db (patch)
tree67c39eb1e99f754acfcd3fab36df921d7742d8a3
parentMerge branch 'master' into #364-offensive-msg-autodeletion (diff)
Update deletion scheduler to use latest watchlist configuration
-rw-r--r--bot/cogs/filtering.py22
1 files changed, 5 insertions, 17 deletions
diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py
index f7cf4c3ea..76ea68660 100644
--- a/bot/cogs/filtering.py
+++ b/bot/cogs/filtering.py
@@ -7,7 +7,7 @@ from typing import List, Mapping, Optional, Union
import dateutil
import discord.errors
from dateutil.relativedelta import relativedelta
-from discord import Colour, DMChannel, HTTPException, Member, Message, NotFound, TextChannel
+from discord import Colour, HTTPException, Member, Message, NotFound, TextChannel
from discord.ext.commands import Cog
from discord.utils import escape_markdown
@@ -56,6 +56,7 @@ def expand_spoilers(text: str) -> str:
split_text[0::2] + split_text[1::2] + split_text
)
+
OFFENSIVE_MSG_DELETE_TIME = timedelta(days=Filter.offensive_msg_delete_days)
@@ -113,6 +114,7 @@ class Filtering(Cog, Scheduler):
"function": self._has_watch_regex_match,
"type": "watchlist",
"content_only": True,
+ "schedule_deletion": True
},
"watch_rich_embeds": {
"enabled": Filter.watch_rich_embeds,
@@ -120,21 +122,7 @@ class Filtering(Cog, Scheduler):
"type": "watchlist",
"content_only": False,
"schedule_deletion": False
- },
- "watch_words": {
- "enabled": Filter.watch_words,
- "function": self._has_watchlist_words,
- "type": "watchlist",
- "content_only": True,
- "schedule_deletion": True
- },
- "watch_tokens": {
- "enabled": Filter.watch_tokens,
- "function": self._has_watchlist_tokens,
- "type": "watchlist",
- "content_only": True,
- "schedule_deletion": True
- },
+ }
}
self.bot.loop.create_task(self.reschedule_offensive_msg_deletion())
@@ -481,7 +469,7 @@ class Filtering(Cog, Scheduler):
await self.bot.wait_until_ready()
response = await self.bot.api_client.get('bot/offensive-messages',)
- now = datetime.datetime.utcnow()
+ now = datetime.utcnow()
for msg in response:
delete_at = dateutil.parser.isoparse(msg['delete_date']).replace(tzinfo=None)