コード例 #1
0
        public static async void SendMessage <T>(Responce <T> responce)
        {
            try
            {
                switch (responce.messageType)
                {
                case Responce <T> .ResponceType.text:
                    await bot.SendTextMessageAsync(responce.id, responce.message.ToString());

                    break;
                }
            }
            catch (Exception ex)
            {
                Utilities.LogError(ex.ToString());
            }
        }
コード例 #2
0
 public static void MessageFromUser(Message message)
 {
     // Текстовые сообщения
     if (message.Type == Telegram.Bot.Types.Enums.MessageType.Text)
     {
         if (Application.messagesEnabled)
         {
             Utilities.Notify($"{message.From.FirstName} [{DateTime.Now.Hour}:{DateTime.Now.Minute}]: {message.Text}");
         }
         PersonFinderUser currentUser = UsersDatabase.UsersDatabase.CheckIsUserInDatabase(message.From.Id);
         if (currentUser == null)
         {
             currentUser = new Scenarious.PersonFinderUser()
             {
                 telegramUser = message.From,
                 userID       = message.From.Id
             };
             Save.users.Add(currentUser);
         }
         string str = message.Text;
         if (str == "/start")
         {
             Responce <string> responce = new Responce <string>()
             {
                 id          = message.From.Id,
                 messageType = Responce <string> .ResponceType.text,
                 message     = $"⚡️Введите ФИО человека: "
             };
             BotController.SendMessage <string>(responce);
         }
         else
         {
         }
     }
     else if (message.Type == Telegram.Bot.Types.Enums.MessageType.Sticker)
     {
     }
 }