/
Laxerem
/
BaskBot
Обзор
Документация
Войти
/
Laxerem
/
BaskBot
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
BaskBot.Application/Bot/Extensions/EventCreator.cs
23 строки
786 B
Laxerem
Start creating a command controller
04 янв 2026, 10:45
04 янв 2026, 10:45
31ca431
Код
Авторство
О чём код?
using BaskBot.Application.Bot.Abstractions; using BaskBot.Application.Bot.External.Events; using Telegram.Bot.Types; using Telegram.Bot.Types.Enums; namespace BaskBot.Application.Bot.External; public static class EventCreator { public static UserEvent Create(Update update) { var updateInfo = UpdateParser.Parse(update); if (updateInfo != null){ switch (updateInfo.Type){ case UpdateType.Message: return new MessageUserEvent(updateInfo, update.Message.Text); case UpdateType.CallbackQuery: return new CallbackQueryUserEvent(updateInfo, update.CallbackQuery.Data, update.CallbackQuery.Id); } } throw new Exception("Unknown update type"); } }