public static void DeserializeAll()
        {
            if (!Directory.Exists(LOCAL))
            {
                return;
            }

            var ids = new DirectoryInfo(LOCAL)
                      .GetDirectories()
                      .Select <DirectoryInfo, UInt64>(di =>
            {
                if (UInt64.TryParse(di.Name, out UInt64 id))
                {
                    return(id);
                }
                return(0);
            }).Where(v => v != 0);

            foreach (var id in ids)
            {
                if (!DutyBot.IsKnownChatId((long)id))
                {
                    DutyBot.groups.Add(DeserializeGroup(id));
                }
            }
        }
Esempio n. 2
0
        public async override Task Execute(TelegramBotClient client, Message message)
        {
            var chatId = message.Chat.Id;

            if (!DutyBot.IsKnownChatId(chatId))
            {
                DutyBot.CreateGroupFor(chatId);

                await client.SendTextMessageAsync(chatId,
                                                  "Начнём) Для получения списка команд используйте /help");
            }
        }