Exemplo n.º 1
0
        public async void PollMesssage()
        {
            while (true)
            {
                var result = await Mybot.GetMessages();

                foreach (TelegramBotSharp.Types.Message m in result)
                {
                    if (m.Chat != null)
                    {
                        listBox1.Items.Add(m.From.Username + " : " + m.Text);
                    }
                    else
                    {
                        listBox1.Items.Add(m.From.Username + " : " + m.Text);
                    }
                    ControlMessage(m);
                }
            }
        }
Exemplo n.º 2
0
        static async void PollMessages()
        {
            while (true)
            {
                var result = await bot.GetMessages();

                foreach (Message m in result)
                {
                    if (m.Chat != null)
                    {
                        Console.WriteLine("[{0}] {1}: {2}", m.Chat.Title, m.From.Username, m.Text);
                    }
                    else
                    {
                        Console.WriteLine("{0}: {1}", m.From.Username, m.Text);
                    }

                    HandleMessage(m);
                }
            }
        }
Exemplo n.º 3
0
        public async void PollMessages()
        {
            string datelog = DateTime.Now.ToString("yyyy:MM:dd HH:mm:ss");

            Pesan     pesen = new Pesan();
            DBConnect db    = new DBConnect();

            string CekJam = DateTime.Now.ToString("yyyy-MM-dd HH:mm");

            while (true)
            {
                var result = await bot.GetMessages();

                string datelog2 = DateTime.Now.ToString("yyyy:MM:dd HH:mm:ss");
                string jam      = DateTime.Now.ToString("HH:mm");



                foreach (Message m in result)
                {
                    if (m.Chat != null)
                    {
                        Console.WriteLine("[{0}] {1}: {2}", m.Chat.Title, m.From.Username, m.Text);
                    }
                    else
                    {
                        Console.WriteLine("{0}: {1}", m.From.Username, m.Text);
                    }

                    HandleMessage(m);
                    //pesen.HandleMessage(m);
                }

                Console.WriteLine("Bot Running -> {0}", datelog2);
            }
        }