示例#1
0
        private async Task CheckResolvedUrls(UpdateEventArgs updateEvent)
        {
            var urls = GetLinks(updateEvent.Update.Message.Text);

            if (urls.Count > 0)
            {
                var resolverUrls = (await _resolverUrlService.GetResolvedUrlsListAsync()).Select(c => c.Url).ToList();

                //  var isIncluded = resolverUrls.Intersect(urls).Any();
                var isIncluded = urls.Except(resolverUrls).Any();

                if (!isIncluded)
                {
                    await DeleteMessage(updateEvent);
                }
                //  await _telegramBot.SendTextMessageAsync(updateEvent.Update.Message.Chat.Id, $"isIncluded: {isIncluded}");
            }
            if (updateEvent.Update.Message.Text.ToLower().Contains("хуй"))
            {
                await DeleteMessage(updateEvent);

                // await BlockUser(updateEvent.Update.Message.From.Id);
            }
        }
 public async Task <IActionResult> Get()
 {
     return(Ok(await _resolverUrlService.GetResolvedUrlsListAsync()));
 }