aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/models
diff options
context:
space:
mode:
Diffstat (limited to 'pydis_site/apps/api/models')
-rw-r--r--pydis_site/apps/api/models/bot/filter_list.py1
-rw-r--r--pydis_site/apps/api/models/bot/infraction.py4
-rw-r--r--pydis_site/apps/api/models/bot/metricity.py14
-rw-r--r--pydis_site/apps/api/models/bot/reminder.py4
4 files changed, 16 insertions, 7 deletions
diff --git a/pydis_site/apps/api/models/bot/filter_list.py b/pydis_site/apps/api/models/bot/filter_list.py
index d279e137..d30f7213 100644
--- a/pydis_site/apps/api/models/bot/filter_list.py
+++ b/pydis_site/apps/api/models/bot/filter_list.py
@@ -12,6 +12,7 @@ class FilterList(ModelTimestampMixin, ModelReprMixin, models.Model):
'FILE_FORMAT '
'DOMAIN_NAME '
'FILTER_TOKEN '
+ 'REDIRECT '
)
type = models.CharField(
max_length=50,
diff --git a/pydis_site/apps/api/models/bot/infraction.py b/pydis_site/apps/api/models/bot/infraction.py
index 60c1e8dd..913631d4 100644
--- a/pydis_site/apps/api/models/bot/infraction.py
+++ b/pydis_site/apps/api/models/bot/infraction.py
@@ -57,6 +57,10 @@ class Infraction(ModelReprMixin, models.Model):
default=False,
help_text="Whether the infraction is a shadow infraction."
)
+ dm_sent = models.BooleanField(
+ null=True,
+ help_text="Whether a DM was sent to the user when infraction was applied."
+ )
def __str__(self):
"""Returns some info on the current infraction, for display purposes."""
diff --git a/pydis_site/apps/api/models/bot/metricity.py b/pydis_site/apps/api/models/bot/metricity.py
index 33fb7ad7..901f191a 100644
--- a/pydis_site/apps/api/models/bot/metricity.py
+++ b/pydis_site/apps/api/models/bot/metricity.py
@@ -4,10 +4,10 @@ from django.db import connections
BLOCK_INTERVAL = 10 * 60 # 10 minute blocks
-EXCLUDE_CHANNELS = [
+EXCLUDE_CHANNELS = (
"267659945086812160", # Bot commands
"607247579608121354" # SeasonalBot commands
-]
+)
class NotFoundError(Exception):
@@ -46,12 +46,12 @@ class Metricity:
self.cursor.execute(
"""
SELECT
- COUNT(*)
+ COUNT(*)
FROM messages
WHERE
- author_id = '%s'
- AND NOT is_deleted
- AND NOT %s::varchar[] @> ARRAY[channel_id]
+ author_id = '%s'
+ AND NOT is_deleted
+ AND channel_id NOT IN %s
""",
[user_id, EXCLUDE_CHANNELS]
)
@@ -79,7 +79,7 @@ class Metricity:
WHERE
author_id='%s'
AND NOT is_deleted
- AND NOT %s::varchar[] @> ARRAY[channel_id]
+ AND channel_id NOT IN %s
GROUP BY interval
) block_query;
""",
diff --git a/pydis_site/apps/api/models/bot/reminder.py b/pydis_site/apps/api/models/bot/reminder.py
index 7d968a0e..173900ee 100644
--- a/pydis_site/apps/api/models/bot/reminder.py
+++ b/pydis_site/apps/api/models/bot/reminder.py
@@ -59,6 +59,10 @@ class Reminder(ModelReprMixin, models.Model):
blank=True,
help_text="IDs of roles or users to ping with the reminder."
)
+ failures = models.IntegerField(
+ default=0,
+ help_text="Number of times we attempted to send the reminder and failed."
+ )
def __str__(self):
"""Returns some info on the current reminder, for display purposes."""