12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System.Collections.Generic;
- using MafiaTelegramBot.Models.Commands;
- using MafiaTelegramBot.Models.Queries;
- using MafiaTelegramBot.Resources;
- using Telegram.Bot;
- namespace MafiaTelegramBot.Models
- {
- public static class Bot
- {
- private static TelegramBotClient _client;
- private static List<Command> _commandsList;
- private static List<Query> _queriesList;
-
- public static IReadOnlyList<Command> Commands => _commandsList.AsReadOnly();
- public static IReadOnlyList<Query> Queries => _queriesList.AsReadOnly();
- public static TelegramBotClient Get()
- {
- if (_client != null) return _client;
- InitCommands();
- InitQueries();
- _client = new TelegramBotClient(AppSettings.Token);
- //var hook = string.Format(AppSettings.Url, "api/message/update");
- //await _client.SetWebhookAsync(hook);
- return _client;
- }
- private static void InitCommands()
- {
- //TODO fill commands array
- _commandsList = new List<Command>
- {
- new StartCommand(),
- new CreateGameCommand(),
- new ConnectGameCommand(),
- new ShowProfileCommand()
- };
- }
-
- private static void InitQueries()
- {
- //TODO fill inline keyboard array
- _queriesList = new List<Query>
- {
- new CreateGame(),
- new ConnectGame(),
- new ShowProfile()
- };
- }
- }
- }
|