示例#1
0
 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
     {
     }
 }
示例#2
0
        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();
        }
示例#3
0
        //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()}");
        }