예제 #1
0
        private async Task <bool> TelegramSendMessage(int ChatId, string Text, Telegram.Bot.Types.ReplyMarkups.IReplyMarkup reply)
        {
            if (db == null)
            {
                db = new MarketBotDbContext();
            }

            var BotInfo = db.BotInfo.Where(b => b.Name == Bot.GeneralFunction.GetBotName()).Include(b => b.Configuration).FirstOrDefault();

            if (BotInfo != null)
            {
                var token = BotInfo.Token;

                TelegramBotClient = new TelegramBotClient(token);

                await TelegramBotClient.SendTextMessageAsync(ChatId, Text, Telegram.Bot.Types.Enums.ParseMode.Default, false, false, 0, reply);

                return(true);
            }

            else
            {
                return(false);
            }
        }
예제 #2
0
 public async Task SendAsync(Func <User.Text, string> getText, Telegram.Bot.Types.ReplyMarkups.IReplyMarkup replyMarkup = null)
 {
     await bot.SendTextMessageAsync(User.ID, getText(User.lang), replyMarkup : replyMarkup);
 }