public async Task <OkResult> Post([FromBody] Update update, [FromServices] BotSingleton singleton)
 {
     if (update?.Type == UpdateType.CallbackQuery)
     {
         await singleton.Bot.ProcessQueryAsync(update.CallbackQuery);
     }
     else
     {
         await singleton.Bot.UpdateAsync(update);
     }
     return(Ok());
 }
        public IActionResult GetCalendar(int id, [FromServices] BotSingleton singleton)
        {
            if (!singleton.Bot.Calendars.ContainsKey(id) || singleton.Bot.Calendars[id].IsOver)
            {
                return(Redirect(singleton.Bot.Config.ErrorPageUrl));
            }

            if (IsApple())
            {
                return(File(singleton.Bot.Calendars[id].IcsContent, ContentType));
            }

            return(Redirect(singleton.Bot.Calendars[id].GoogleCalendarLink));
        }
        public async Task <IActionResult> Index([FromServices] BotSingleton singleton)
        {
            User model = await singleton.Bot.GetUserAsunc();

            return(View(model));
        }
        public async Task <OkResult> Post([FromBody] Update update, [FromServices] BotSingleton singleton)
        {
            await singleton.Bot.UpdateAsync(update);

            return(Ok());
        }
예제 #5
0
 public BotService(BotSingleton singleton) => _bot = singleton.Bot;