Exemple #1
0
        private async void btnEnviar_ClickAsync(object sender, EventArgs e)
        {
            if (txtMensagem.Text.Trim().Equals(string.Empty))
            {
                MessageBox.Show("Informe a mensagem para envio!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            try
            {
                var telegramBot = new TelegramBotClient("TOKEN_DO_SEU_BOT");
                var strMensagem = txtMensagem.Text.Trim();

                strMensagem = EmojiConfig.Config(strMensagem);

                await telegramBot.SendTextMessageAsync(chatId : "ID_DO_SEU_CHAT", text : strMensagem, parseMode : ParseMode.Html);

                MessageBox.Show("Mensagem enviada com sucesso!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao enviar mensagem! " + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                txtMensagem.Text = string.Empty;
            }
        }
Exemple #2
0
        private async void timerControle_TickAsync(object sender, EventArgs e)
        {
            try
            {
                var telegramBot   = new TelegramBotClient("TOKEN_DO_SEU_BOT");
                var mensagemAtual = lstMensagens[posicaoEnvio];

                mensagemAtual = EmojiConfig.Config(mensagemAtual);

                await telegramBot.SendTextMessageAsync(chatId : "ID_DO_SEU_CHAT", text : mensagemAtual, parseMode : ParseMode.Html);

                posicaoEnvio++;

                //Atualizar o progresso de envio
                AtualizarProgressoEnvio();

                if (posicaoEnvio == lstMensagens.Count)
                {
                    PararTimerControle();
                }
            }
            catch (Exception ex)
            {
                PararTimerControle();
                MessageBox.Show("Erro ao enviar mensagem! " + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
0
        private async void TimerControle_Tick(object sender, EventArgs e)
        {
            try
            {
                var telegramBot  = new TelegramBotClient("1432240157:AAE_14LbHxjMqx5S4NrqFfdlL1K8DVCD8H8");
                var mesagemAtual = lstMensagens[posicaoEnvio];

                mesagemAtual = EmojiConfig.Config(mesagemAtual);

                await telegramBot.SendTextMessageAsync(chatId : "-1001386936204", text : mesagemAtual, parseMode : ParseMode.Html);

                posicaoEnvio++;

                //Atualizar progresso de envio
                AtualizarProgressoEnvio();

                if (posicaoEnvio == lstMensagens.Count)
                {
                    PararTimerControle();
                }
            }
            catch (Exception ex)
            {
                PararTimerControle();
                MessageBox.Show("Erro ao enviar mensagem! " + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #4
0
        private async void btnEnviar_Click(object sender, EventArgs e)
        {
            if (txtMensagem.Text.Trim().Equals(string.Empty))
            {
                MessageBox.Show("Informe a mensagem para envio!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            try
            {
                var telegramBot = new TelegramBotClient("1432240157:AAE_14LbHxjMqx5S4NrqFfdlL1K8DVCD8H8");
                var strMensagem = txtMensagem.Text.Trim();

                strMensagem = EmojiConfig.Config(strMensagem);

                await telegramBot.SendTextMessageAsync(chatId : "-1001386936204", text : strMensagem, parseMode : ParseMode.Html);

                MessageBox.Show("Mensagem enviada com sucesso!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao enviar mensagem! " + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                txtMensagem.Text = string.Empty;
            }
        }
Exemple #5
0
        private async void timerControle_Tick(object sernder, EventArgs e)
        {
            try
            {
                var telegrambot   = new TelegramBotClient("1828957988:AAEEJzFdazsiXu1sb9DuWd0GBRdcMU00wIw");
                var mensagemAtual = lstMensagens[posicaoEnvio];
                mensagemAtual = EmojiConfig.Config(mensagemAtual);
                //https://emojipedia.org/people/
                //https://k3a.me/telegram-emoji-list-codes-descriptions/
                await telegrambot.SendTextMessageAsync(chatId : "-1001488109717", text : mensagemAtual, parseMode : ParseMode.Html);

                posicaoEnvio++;
                //atualizar o processo envio
                AtualizarProgressoEnvio();
                if (posicaoEnvio == lstMensagens.Count)
                {
                    PararTimerControle();
                }
            }
            catch (Exception ex)
            {
                PararTimerControle();
                MessageBox.Show("Erro ao enviar mensagem! " + ex.Message, this.Text, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Exemple #6
0
        private async void btnEnviar_Click(object sender, EventArgs e)
        {
            if (txtMensagem.Text.Trim().Equals(string.Empty))
            {
                MessageBox.Show("Informe a mensagem para o envio!", this.Text, MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
                return;
            }
            try
            {
                var telegrambot = new TelegramBotClient("1828957988:AAEEJzFdazsiXu1sb9DuWd0GBRdcMU00wIw");
                var strMensagem = txtMensagem.Text.Trim();

                strMensagem = EmojiConfig.Config(strMensagem);
                //https://emojipedia.org/people/
                //https://k3a.me/telegram-emoji-list-codes-descriptions/
                await telegrambot.SendTextMessageAsync(chatId : "-1001488109717", text : strMensagem,
                                                       parseMode : ParseMode.Html
                                                       );

                MessageBox.Show("Mensagem enviada com sucesso!", this.Text, MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao enviar mensagem! " + ex.Message, this.Text, MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
            finally
            {
                txtMensagem.Text = string.Empty;
            }
        }