2024-05-29 00:28:17 +03:00
|
|
|
using Kruzya.TelegramBot.Core.Attributes;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Telegram.Bot.Types;
|
|
|
|
|
|
|
|
|
|
namespace Kruzya.TelegramBot.CustomChatAddOns.Data
|
|
|
|
|
{
|
|
|
|
|
[AllowedSerializableType("ping")]
|
|
|
|
|
public class Ping
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("chat_id")]
|
|
|
|
|
public long ChatId { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("user_id")]
|
|
|
|
|
public long UserId { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("confirmation")]
|
|
|
|
|
public string Confirmation { get; set; } = Guid.NewGuid().ToString();
|
|
|
|
|
|
2024-05-29 00:59:55 +03:00
|
|
|
public static Ping From(Message message) => new() {
|
2024-05-29 00:28:17 +03:00
|
|
|
ChatId = message.Chat.Id,
|
|
|
|
|
UserId = message.From!.Id
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|