Fix Discord co-GM management
Deploy Telegram Bot / build-and-push (push) Successful in 5m58s
Deploy Telegram Bot / scan-images (push) Successful in 3m39s
Deploy Telegram Bot / deploy (push) Successful in 34s

This commit is contained in:
2026-05-27 16:32:47 +03:00
parent 7a2965b43f
commit fac5d75c7e
5 changed files with 129 additions and 24 deletions
+18 -2
View File
@@ -28,6 +28,7 @@ public sealed record WebGameGroup(
public sealed record WebGroupManager(
long TelegramId,
string? ExternalUserId,
string? Platform,
string DisplayName,
string? TelegramUsername,
string? ExternalUsername,
@@ -35,7 +36,17 @@ public sealed record WebGroupManager(
DateTime AddedAt)
{
public WebGroupManager(long telegramId, string displayName, string? telegramUsername, string role, DateTime addedAt)
: this(telegramId, null, displayName, telegramUsername, null, role, addedAt) { }
: this(telegramId, null, null, displayName, telegramUsername, null, role, addedAt) { }
public WebGroupManager(
long telegramId,
string? externalUserId,
string displayName,
string? telegramUsername,
string? externalUsername,
string role,
DateTime addedAt)
: this(telegramId, externalUserId, null, displayName, telegramUsername, externalUsername, role, addedAt) { }
}
public sealed record WebGroupManagement(
@@ -215,8 +226,13 @@ public sealed class SessionService(
await using var conn = await dataSource.OpenConnectionAsync();
return (await conn.QueryAsync<WebGroupManager>(
"""
SELECT COALESCE(p.external_user_id::BIGINT, 0) AS TelegramId,
SELECT CASE
WHEN p.platform = 'Telegram' AND p.external_user_id ~ '^[0-9]+$'
THEN p.external_user_id::BIGINT
ELSE 0
END AS TelegramId,
p.external_user_id AS ExternalUserId,
p.platform AS Platform,
p.display_name AS DisplayName,
p.external_username AS TelegramUsername,
p.external_username AS ExternalUsername,