internal void DeletMessage(int telegramid) { try { var findIdDb = MessageStorage.GetDbId(telegramid); var custumer = contex.UserMessages.Single(x => x.Id == findIdDb); contex.UserMessages.Remove(custumer); contex.SaveChanges(); } catch { } }
public static void Main(string[] args) { ThreadPool.QueueUserWorkItem(TredSend); ThreadPool.QueueUserWorkItem(TredSendAll); Console.WriteLine("Hello"); main2.RunBot(); //ServiceBase[] ServicesToRun; //ServicesToRun = new ServiceBase[] //{ // new Service1() //}; //ServiceBase.Run(ServicesToRun); Console.ReadLine(); var text = MessageStorage.GetAllTextDb(); Console.WriteLine(text); Console.ReadLine(); }
//static ITelegramBotClient public async Task Execute(IJobExecutionContext context) { TelegramBotClient telegramBot = new TelegramBotClient("751343084:AAGXzuDEhmEq4ZjjMm--JHFu4Jrb58yOK_E"); int user = 273166881; await telegramBot.SendTextMessageAsync(user, $"{MessageStorage.GetAllTextDb()}"); }