8bcd16fbc9
PR Checks / test-and-build (pull_request) Successful in 12m35s
Introduce platform-neutral PlatformKind, PlatformUser, PlatformGroup, and IPlatformMessenger contracts in GmRelay.Shared. Route Telegram session schedule updates, direct notifications, interaction replies, and calendar export through TelegramPlatformMessenger while preserving existing Telegram behavior. Bump version -> 2.0.1
30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
using System.Globalization;
|
|
using GmRelay.Shared.Platform;
|
|
|
|
namespace GmRelay.Bot.Infrastructure.Telegram;
|
|
|
|
internal static class TelegramPlatformIds
|
|
{
|
|
public static PlatformGroup Group(long chatId, int? threadId = null, string? displayName = null) =>
|
|
new(
|
|
PlatformKind.Telegram,
|
|
chatId.ToString(CultureInfo.InvariantCulture),
|
|
displayName ?? "Telegram chat",
|
|
ExternalChannelId: chatId.ToString(CultureInfo.InvariantCulture),
|
|
ExternalThreadId: threadId?.ToString(CultureInfo.InvariantCulture));
|
|
|
|
public static PlatformUser User(long telegramId, string displayName, string? username = null) =>
|
|
new(
|
|
PlatformKind.Telegram,
|
|
telegramId.ToString(CultureInfo.InvariantCulture),
|
|
displayName,
|
|
username);
|
|
|
|
public static PlatformMessageRef Message(long chatId, int? threadId, int messageId) =>
|
|
new(
|
|
PlatformKind.Telegram,
|
|
chatId.ToString(CultureInfo.InvariantCulture),
|
|
threadId?.ToString(CultureInfo.InvariantCulture),
|
|
messageId.ToString(CultureInfo.InvariantCulture));
|
|
}
|