From 68d1d75d19df39c018578b8928c36547bfca7304 Mon Sep 17 00:00:00 2001 From: Johannes Christ Date: Thu, 7 Feb 2019 21:59:42 +0100 Subject: Add a bot setting model. --- api/models.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'api/models.py') diff --git a/api/models.py b/api/models.py index fa68f31c..86c99f86 100644 --- a/api/models.py +++ b/api/models.py @@ -5,7 +5,7 @@ from django.core.validators import MaxValueValidator, MinValueValidator, RegexVa from django.db import models from django.utils import timezone -from .validators import validate_tag_embed +from .validators import validate_bot_setting_name, validate_tag_embed class ModelReprMixin: @@ -27,6 +27,19 @@ class ModelReprMixin: return f'<{self.__class__.__name__}({attributes})>' +class BotSetting(ModelReprMixin, models.Model): + """A configuration entry for the bot.""" + + name = models.CharField( + primary_key=True, + max_length=50, + validators=(validate_bot_setting_name,) + ) + data = pgfields.JSONField( + help_text="The actual settings of this setting." + ) + + class DocumentationLink(ModelReprMixin, models.Model): """A documentation link used by the `!docs` command of the bot.""" -- cgit v1.2.3