Skip to content

models

Pydantic configuration models for Tux.

This module contains all the Pydantic models for configuration, extracted from the existing config.py file for better organization.

Classes:

  • BotInfo

    Bot information configuration.

  • UserIds

    User ID configuration.

  • StatusRoles

    Status roles configuration.

  • TempVC

    Temporary voice channel configuration.

  • GifLimiter

    GIF limiter configuration.

  • XP

    XP system configuration.

  • Snippets

    Snippets configuration.

  • IRC

    IRC bridge configuration.

  • ExternalServices

    External services configuration.

  • DatabaseConfig

    Database configuration with automatic URL construction.

Classes

BotInfo pydantic-model

Bases: BaseModel

Bot information configuration.

Show JSON schema:
JSON
{
  "description": "Bot information configuration.",
  "properties": {
    "BOT_NAME": {
      "default": "Tux",
      "description": "Name of the bot",
      "title": "Bot Name",
      "type": "string"
    },
    "ACTIVITIES": {
      "default": "[]",
      "description": "Bot activities",
      "title": "Activities",
      "type": "string"
    },
    "HIDE_BOT_OWNER": {
      "default": false,
      "description": "Hide bot owner info",
      "title": "Hide Bot Owner",
      "type": "boolean"
    },
    "PREFIX": {
      "default": "$",
      "description": "Command prefix",
      "title": "Prefix",
      "type": "string"
    }
  },
  "title": "BotInfo",
  "type": "object"
}

Fields:

Attributes

BOT_NAME pydantic-field
Python
BOT_NAME: str = 'Tux'

Name of the bot

ACTIVITIES pydantic-field
Python
ACTIVITIES: str = '[]'

Bot activities

HIDE_BOT_OWNER pydantic-field
Python
HIDE_BOT_OWNER: bool = False

Hide bot owner info

PREFIX pydantic-field
Python
PREFIX: str = '$'

Command prefix

UserIds pydantic-model

Bases: BaseModel

User ID configuration.

Show JSON schema:
JSON
{
  "description": "User ID configuration.",
  "properties": {
    "BOT_OWNER_ID": {
      "default": 0,
      "description": "Bot owner user ID",
      "title": "Bot Owner Id",
      "type": "integer"
    },
    "SYSADMINS": {
      "description": "System admin user IDs",
      "items": {
        "type": "integer"
      },
      "title": "Sysadmins",
      "type": "array"
    }
  },
  "title": "UserIds",
  "type": "object"
}

Fields:

Attributes

BOT_OWNER_ID pydantic-field
Python
BOT_OWNER_ID: int = 0

Bot owner user ID

SYSADMINS pydantic-field
Python
SYSADMINS: list[int]

System admin user IDs

StatusRoles pydantic-model

Bases: BaseModel

Status roles configuration.

Show JSON schema:
JSON
{
  "description": "Status roles configuration.",
  "properties": {
    "MAPPINGS": {
      "description": "Status to role mappings",
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "title": "Mappings",
      "type": "array"
    }
  },
  "title": "StatusRoles",
  "type": "object"
}

Fields:

Attributes

MAPPINGS pydantic-field
Python
MAPPINGS: list[dict[str, Any]]

Status to role mappings

TempVC pydantic-model

Bases: BaseModel

Temporary voice channel configuration.

Show JSON schema:
JSON
{
  "description": "Temporary voice channel configuration.",
  "properties": {
    "TEMPVC_CHANNEL_ID": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Temporary VC channel ID",
      "title": "Tempvc Channel Id"
    },
    "TEMPVC_CATEGORY_ID": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Temporary VC category ID",
      "title": "Tempvc Category Id"
    }
  },
  "title": "TempVC",
  "type": "object"
}

Fields:

Attributes

TEMPVC_CHANNEL_ID pydantic-field
Python
TEMPVC_CHANNEL_ID: str | None = None

Temporary VC channel ID

TEMPVC_CATEGORY_ID pydantic-field
Python
TEMPVC_CATEGORY_ID: str | None = None

Temporary VC category ID

GifLimiter pydantic-model

Bases: BaseModel

GIF limiter configuration.

Show JSON schema:
JSON
{
  "description": "GIF limiter configuration.",
  "properties": {
    "RECENT_GIF_AGE": {
      "default": 60,
      "description": "Recent GIF age limit",
      "title": "Recent Gif Age",
      "type": "integer"
    },
    "GIF_LIMITS_USER": {
      "additionalProperties": {
        "type": "integer"
      },
      "description": "User GIF limits",
      "title": "Gif Limits User",
      "type": "object"
    },
    "GIF_LIMITS_CHANNEL": {
      "additionalProperties": {
        "type": "integer"
      },
      "description": "Channel GIF limits",
      "title": "Gif Limits Channel",
      "type": "object"
    },
    "GIF_LIMIT_EXCLUDE": {
      "description": "Excluded channels",
      "items": {
        "type": "integer"
      },
      "title": "Gif Limit Exclude",
      "type": "array"
    }
  },
  "title": "GifLimiter",
  "type": "object"
}

Fields:

Attributes

RECENT_GIF_AGE pydantic-field
Python
RECENT_GIF_AGE: int = 60

Recent GIF age limit

GIF_LIMITS_USER pydantic-field
Python
GIF_LIMITS_USER: dict[int, int]

User GIF limits

GIF_LIMITS_CHANNEL pydantic-field
Python
GIF_LIMITS_CHANNEL: dict[int, int]

Channel GIF limits

GIF_LIMIT_EXCLUDE pydantic-field
Python
GIF_LIMIT_EXCLUDE: list[int]

Excluded channels

XP pydantic-model

Bases: BaseModel

XP system configuration.

Show JSON schema:
JSON
{
  "description": "XP system configuration.",
  "properties": {
    "XP_BLACKLIST_CHANNELS": {
      "description": "XP blacklist channels",
      "items": {
        "type": "integer"
      },
      "title": "Xp Blacklist Channels",
      "type": "array"
    },
    "XP_ROLES": {
      "description": "XP roles",
      "items": {
        "additionalProperties": {
          "type": "integer"
        },
        "type": "object"
      },
      "title": "Xp Roles",
      "type": "array"
    },
    "XP_MULTIPLIERS": {
      "description": "XP multipliers",
      "items": {
        "additionalProperties": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "number"
            }
          ]
        },
        "type": "object"
      },
      "title": "Xp Multipliers",
      "type": "array"
    },
    "XP_COOLDOWN": {
      "default": 1,
      "description": "XP cooldown in seconds",
      "title": "Xp Cooldown",
      "type": "integer"
    },
    "LEVELS_EXPONENT": {
      "default": 2,
      "description": "Levels exponent",
      "title": "Levels Exponent",
      "type": "integer"
    },
    "SHOW_XP_PROGRESS": {
      "default": true,
      "description": "Show XP progress",
      "title": "Show Xp Progress",
      "type": "boolean"
    },
    "ENABLE_XP_CAP": {
      "default": false,
      "description": "Enable XP cap",
      "title": "Enable Xp Cap",
      "type": "boolean"
    }
  },
  "title": "XP",
  "type": "object"
}

Fields:

Attributes

XP_BLACKLIST_CHANNELS pydantic-field
Python
XP_BLACKLIST_CHANNELS: list[int]

XP blacklist channels

XP_ROLES pydantic-field
Python
XP_ROLES: list[dict[str, int]]

XP roles

XP_MULTIPLIERS pydantic-field
Python
XP_MULTIPLIERS: list[dict[str, int | float]]

XP multipliers

XP_COOLDOWN pydantic-field
Python
XP_COOLDOWN: int = 1

XP cooldown in seconds

LEVELS_EXPONENT pydantic-field
Python
LEVELS_EXPONENT: int = 2

Levels exponent

SHOW_XP_PROGRESS pydantic-field
Python
SHOW_XP_PROGRESS: bool = True

Show XP progress

ENABLE_XP_CAP pydantic-field
Python
ENABLE_XP_CAP: bool = False

Enable XP cap

Snippets pydantic-model

Bases: BaseModel

Snippets configuration.

Show JSON schema:
JSON
{
  "description": "Snippets configuration.",
  "properties": {
    "LIMIT_TO_ROLE_IDS": {
      "default": false,
      "description": "Limit snippets to specific roles",
      "title": "Limit To Role Ids",
      "type": "boolean"
    },
    "ACCESS_ROLE_IDS": {
      "description": "Snippet access role IDs",
      "items": {
        "type": "integer"
      },
      "title": "Access Role Ids",
      "type": "array"
    }
  },
  "title": "Snippets",
  "type": "object"
}

Fields:

Attributes

LIMIT_TO_ROLE_IDS pydantic-field
Python
LIMIT_TO_ROLE_IDS: bool = False

Limit snippets to specific roles

ACCESS_ROLE_IDS pydantic-field
Python
ACCESS_ROLE_IDS: list[int]

Snippet access role IDs

IRC pydantic-model

Bases: BaseModel

IRC bridge configuration.

Show JSON schema:
JSON
{
  "description": "IRC bridge configuration.",
  "properties": {
    "BRIDGE_WEBHOOK_IDS": {
      "description": "IRC bridge webhook IDs",
      "items": {
        "type": "integer"
      },
      "title": "Bridge Webhook Ids",
      "type": "array"
    }
  },
  "title": "IRC",
  "type": "object"
}

Fields:

Attributes

BRIDGE_WEBHOOK_IDS pydantic-field
Python
BRIDGE_WEBHOOK_IDS: list[int]

IRC bridge webhook IDs

ExternalServices pydantic-model

Bases: BaseModel

External services configuration.

Show JSON schema:
JSON
{
  "description": "External services configuration.",
  "properties": {
    "SENTRY_DSN": {
      "default": "",
      "description": "Sentry DSN",
      "title": "Sentry Dsn",
      "type": "string"
    },
    "GITHUB_APP_ID": {
      "default": "",
      "description": "GitHub app ID",
      "title": "Github App Id",
      "type": "string"
    },
    "GITHUB_INSTALLATION_ID": {
      "default": "",
      "description": "GitHub installation ID",
      "title": "Github Installation Id",
      "type": "string"
    },
    "GITHUB_PRIVATE_KEY": {
      "default": "",
      "description": "GitHub private key",
      "title": "Github Private Key",
      "type": "string"
    },
    "GITHUB_CLIENT_ID": {
      "default": "",
      "description": "GitHub client ID",
      "title": "Github Client Id",
      "type": "string"
    },
    "GITHUB_CLIENT_SECRET": {
      "default": "",
      "description": "GitHub client secret",
      "title": "Github Client Secret",
      "type": "string"
    },
    "GITHUB_REPO_URL": {
      "default": "",
      "description": "GitHub repository URL",
      "title": "Github Repo Url",
      "type": "string"
    },
    "GITHUB_REPO_OWNER": {
      "default": "",
      "description": "GitHub repository owner",
      "title": "Github Repo Owner",
      "type": "string"
    },
    "GITHUB_REPO": {
      "default": "",
      "description": "GitHub repository name",
      "title": "Github Repo",
      "type": "string"
    },
    "MAILCOW_API_KEY": {
      "default": "",
      "description": "Mailcow API key",
      "title": "Mailcow Api Key",
      "type": "string"
    },
    "MAILCOW_API_URL": {
      "default": "",
      "description": "Mailcow API URL",
      "title": "Mailcow Api Url",
      "type": "string"
    },
    "WOLFRAM_APP_ID": {
      "default": "",
      "description": "Wolfram Alpha app ID",
      "title": "Wolfram App Id",
      "type": "string"
    },
    "INFLUXDB_TOKEN": {
      "default": "",
      "description": "InfluxDB token",
      "title": "Influxdb Token",
      "type": "string"
    },
    "INFLUXDB_URL": {
      "default": "",
      "description": "InfluxDB URL",
      "title": "Influxdb Url",
      "type": "string"
    },
    "INFLUXDB_ORG": {
      "default": "",
      "description": "InfluxDB organization",
      "title": "Influxdb Org",
      "type": "string"
    }
  },
  "title": "ExternalServices",
  "type": "object"
}

Fields:

Attributes

SENTRY_DSN pydantic-field
Python
SENTRY_DSN: str = ''

Sentry DSN

GITHUB_APP_ID pydantic-field
Python
GITHUB_APP_ID: str = ''

GitHub app ID

GITHUB_INSTALLATION_ID pydantic-field
Python
GITHUB_INSTALLATION_ID: str = ''

GitHub installation ID

GITHUB_PRIVATE_KEY pydantic-field
Python
GITHUB_PRIVATE_KEY: str = ''

GitHub private key

GITHUB_CLIENT_ID pydantic-field
Python
GITHUB_CLIENT_ID: str = ''

GitHub client ID

GITHUB_CLIENT_SECRET pydantic-field
Python
GITHUB_CLIENT_SECRET: str = ''

GitHub client secret

GITHUB_REPO_URL pydantic-field
Python
GITHUB_REPO_URL: str = ''

GitHub repository URL

GITHUB_REPO_OWNER pydantic-field
Python
GITHUB_REPO_OWNER: str = ''

GitHub repository owner

GITHUB_REPO pydantic-field
Python
GITHUB_REPO: str = ''

GitHub repository name

MAILCOW_API_KEY pydantic-field
Python
MAILCOW_API_KEY: str = ''

Mailcow API key

MAILCOW_API_URL pydantic-field
Python
MAILCOW_API_URL: str = ''

Mailcow API URL

WOLFRAM_APP_ID pydantic-field
Python
WOLFRAM_APP_ID: str = ''

Wolfram Alpha app ID

INFLUXDB_TOKEN pydantic-field
Python
INFLUXDB_TOKEN: str = ''

InfluxDB token

INFLUXDB_URL pydantic-field
Python
INFLUXDB_URL: str = ''

InfluxDB URL

INFLUXDB_ORG pydantic-field
Python
INFLUXDB_ORG: str = ''

InfluxDB organization

DatabaseConfig pydantic-model

Bases: BaseModel

Database configuration with automatic URL construction.

Show JSON schema:
JSON
{
  "description": "Database configuration with automatic URL construction.",
  "properties": {
    "POSTGRES_HOST": {
      "default": "localhost",
      "description": "PostgreSQL host",
      "title": "Postgres Host",
      "type": "string"
    },
    "POSTGRES_PORT": {
      "default": 5432,
      "description": "PostgreSQL port",
      "title": "Postgres Port",
      "type": "integer"
    },
    "POSTGRES_DB": {
      "default": "tuxdb",
      "description": "PostgreSQL database name",
      "title": "Postgres Db",
      "type": "string"
    },
    "POSTGRES_USER": {
      "default": "tuxuser",
      "description": "PostgreSQL username",
      "title": "Postgres User",
      "type": "string"
    },
    "POSTGRES_PASSWORD": {
      "default": "tuxpass",
      "description": "PostgreSQL password",
      "title": "Postgres Password",
      "type": "string"
    },
    "DATABASE_URL": {
      "default": "",
      "description": "Custom database URL override",
      "title": "Database Url",
      "type": "string"
    }
  },
  "title": "DatabaseConfig",
  "type": "object"
}

Fields:

Attributes

POSTGRES_HOST pydantic-field
Python
POSTGRES_HOST: str = 'localhost'

PostgreSQL host

POSTGRES_PORT pydantic-field
Python
POSTGRES_PORT: int = 5432

PostgreSQL port

POSTGRES_DB pydantic-field
Python
POSTGRES_DB: str = 'tuxdb'

PostgreSQL database name

POSTGRES_USER pydantic-field
Python
POSTGRES_USER: str = 'tuxuser'

PostgreSQL username

POSTGRES_PASSWORD pydantic-field
Python
POSTGRES_PASSWORD: str = 'tuxpass'

PostgreSQL password

DATABASE_URL pydantic-field
Python
DATABASE_URL: str = ''

Custom database URL override

Functions

get_database_url
Python
get_database_url() -> str

Get database URL, either custom or constructed from individual parts.

Returns:

  • str

    Complete PostgreSQL database URL.