feat(gateway): add Discord external chat platform

This commit is contained in:
Anish Sarkar 2026-06-01 20:58:17 +05:30
parent 78fbca1967
commit 4b8ca29f9e
2 changed files with 119 additions and 1 deletions

View file

@ -578,6 +578,7 @@ class ExternalChatPlatform(StrEnum):
TELEGRAM = "telegram"
WHATSAPP = "whatsapp"
SLACK = "slack"
DISCORD = "discord"
SIGNAL = "signal"
@ -890,7 +891,9 @@ class ExternalChatAccount(Base, TimestampMixin):
"platform",
unique=True,
postgresql_where=text(
"is_system_account = true AND NOT (cursor_state ? 'team_id')"
"is_system_account = true "
"AND NOT (cursor_state ? 'team_id') "
"AND NOT (cursor_state ? 'guild_id')"
),
),
Index(
@ -902,6 +905,15 @@ class ExternalChatAccount(Base, TimestampMixin):
"is_system_account = true AND cursor_state ? 'team_id'"
),
),
Index(
"uq_external_chat_accounts_discord_guild",
"platform",
text("(cursor_state ->> 'guild_id')"),
unique=True,
postgresql_where=text(
"is_system_account = true AND cursor_state ? 'guild_id'"
),
),
Index(
"uq_external_chat_accounts_webhook_secret",
"webhook_secret",