|
@@ -1,9 +1,10 @@
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
using MafiaTelegramBot.Models.Commands;
|
|
|
using MafiaTelegramBot.Models.Inlines;
|
|
|
-using MafiaTelegramBot.Models.Replies;
|
|
|
+using MafiaTelegramBot.Models.Payments;
|
|
|
using MafiaTelegramBot.Resources;
|
|
|
using Telegram.Bot;
|
|
|
using Telegram.Bot.Types;
|
|
@@ -17,11 +18,11 @@ namespace MafiaTelegramBot.Models
|
|
|
private static TelegramBotClient _client;
|
|
|
private static List<Command> _commandsList;
|
|
|
private static List<Query> _queriesList;
|
|
|
- private static List<Reply> _repliesList;
|
|
|
+ private static List<Payment> _paymentsList;
|
|
|
|
|
|
public static IReadOnlyList<Command> Commands => _commandsList.AsReadOnly();
|
|
|
public static IReadOnlyList<Query> Queries => _queriesList.AsReadOnly();
|
|
|
- public static IReadOnlyList<Reply> Replies => _repliesList.AsReadOnly();
|
|
|
+ public static IReadOnlyList<Payment> Payments => _paymentsList.AsReadOnly();
|
|
|
|
|
|
public static readonly List<long> UsersThatChangesNickname = new();
|
|
|
public static readonly Dictionary<long, string[]> UsersThatCreatesRoom = new();
|
|
@@ -32,7 +33,7 @@ namespace MafiaTelegramBot.Models
|
|
|
if (_client != null) return _client;
|
|
|
InitCommands();
|
|
|
InitQueries();
|
|
|
- InitReplies();
|
|
|
+ InitPayments();
|
|
|
_client = new TelegramBotClient(AppSettings.Token);
|
|
|
return _client;
|
|
|
}
|
|
@@ -83,10 +84,13 @@ namespace MafiaTelegramBot.Models
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- private static void InitReplies()
|
|
|
+ private static void InitPayments()
|
|
|
{
|
|
|
//TODO fill inline keyboard array
|
|
|
- _repliesList = new List<Reply>();
|
|
|
+ _paymentsList = new List<Payment>
|
|
|
+ {
|
|
|
+ new RandomRolePayment()
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
public static async Task<Message> SendStickerAsync(long chatId, string fileId)
|
|
@@ -143,5 +147,13 @@ namespace MafiaTelegramBot.Models
|
|
|
return new Message();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public static async Task AnswerPreCheckoutQuery(string preCheckoutQueryId)
|
|
|
+ {
|
|
|
+ Console.WriteLine(preCheckoutQueryId);
|
|
|
+ var token = new CancellationToken();
|
|
|
+ await Get().AnswerPreCheckoutQueryAsync(preCheckoutQueryId, token);
|
|
|
+ Console.WriteLine(token.IsCancellationRequested);
|
|
|
+ }
|
|
|
}
|
|
|
}
|