/// <summary> /// Добавляем бота в бд /// </summary> /// <param name="Token"></param> /// <returns></returns> private async Task <IActionResult> InstertBot(string Token) { try { var Getme = await TelegramFunction.GetMe(Token); BotConnectFunction = new BotConnectFunction(); var bot = BotConnectFunction.AddBot(Getme, Token, base.FollowerId); if (bot != null) { return(await SendServiceTypeList(bot.Id)); } else { return(OkResult); } } catch (Exception e) { if (e.Message.Contains("token")) { await SendMessage(new BotMessage { TextMessage = "Ошибка! Не верный токен" }); } return(await SendTextMessageAndForceReply("Создайте бота с помощью @Botfather и пришлите Токен доступа", EnterBotTokenForce)); } finally { if (BotConnectFunction != null) { BotConnectFunction.Dispose(); } } }
private async Task <IActionResult> CheckPay(int BotId, int InvoiceId) { try { BotConnectFunction = new BotConnectFunction(); base.SendAction(Telegram.Bot.Types.Enums.ChatAction.Typing); var bot = await BotConnectFunction.CheckPay(BotId, InvoiceId); BotMessage = new BotInfoMessage(bot); await base.EditMessage(BotMessage.BuildMsg()); return(OkResult); } catch (BotInstallExeption.BotIsLaunchedExeption e) { await base.AnswerCallback(e.Message, true); await SendMessage(Convert.ToInt32(BotInfo.OwnerChatId), new BotMessage { TextMessage = e.Message }); return(OkResult); } catch (Exception e) { await base.AnswerCallback(e.Message, true); await SendMessage(Convert.ToInt32(BotInfo.OwnerChatId), new BotMessage { TextMessage = e.Message }); return(OkResult); } finally { BotConnectFunction.Dispose(); } }