Discussão do artigo "Como criar bots para Telegram em MQL5" - página 55

 
Você tem alguma ideia de como adicionar a função Inline Keyboard a isso?
 
int OnInit()
  {
   string fileType = "png";
   string fileName = "MewPhoto." + fileType;
   ChartScreenShot(0, fileName, 900, 900, ALIGN_RIGHT);
   Sleep(50);
   bot.Token(Token);
   int result = bot.GetMe();
   bot.GetUpdates();
   Comment("Bot Name ",bot.Name());
   bot.SendChatAction(int(ChatId),ACTION_UPLOAD_PHOTO);
   Sleep(500);
   if(FileIsExist(fileName))
     {
      string photo_id;
      result=bot.SendPhoto(photo_id,ChatId,fileName,"Hello");
     }
   if(!FileIsExist(fileName))
     {Alert("Image not find");}
// EventSetTimer(60);

//---
   return(INIT_SUCCEEDED);
  }
Qualquer pessoa que tenha sucesso com o SendPhoto! Por favor, me ajude! Não há imagens enviadas para o Telegram
 
Cerilo Cabacoy 'Código de erro 400 Descrição "Solicitação incorreta: chat não encontrado"

Alguém encontrou o mesmo problema? Você pode dar alguns motivos pelos quais esse erro pode ter ocorrido?

Fiz muitas pesquisas on-line, mas não consegui obter as respostas corretas.


Acabei de receber o mesmo erro" Código de erro400 Descrição "Solicitação incorreta: chat não encontrado", mas tudo funcionava perfeitamente antes. Também fiz algumas pesquisas e não encontrei nenhuma solução.

Alguém poderia me dar uma luz sobre como corrigir esse problema? Obrigado pela atenção

#include <Telegram.mqh>
//--- parâmetros de entrada
input string InpToken="7504821711:AAFljwzACG8ezAhRXzDB2iU9BDM5p0VTDKs";
input string InpChannelName="Test_Error_SendMessage";/Nome do canal
//--- variáveis globais
CCustomBot bot;
int OnInit()
  {
//--- definir token
   bot.Token(InpToken);  
  //--- 
   return(INIT_SUCCEEDED);
  }
//// Pressione "A" no teclado para testar e obter o erro: "Código de erro 400 Descrição "Solicitação incorreta: chat não encontrado"
void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
    {
        if (id== CHARTEVENT_KEYDOWN && lparam == StringGetChar("A",0)){
        const string msg = bot.Name();
        // enviar mensagem
        int res=bot.SendMessage(InpChannelName,msg);
        if(res!=0) Print("Error: ",GetErrorDescription(res));  
        }               
    }
void OnTick()
  {
  return;
  }    
void OnDeinit(const int reason)
  {
  return;
  }
// fim do teste
 
aphong Código de erro400 Descrição "Solicitação incorreta: chat não encontrado", mas tudo funcionava perfeitamente antes. Também fiz algumas pesquisas e não encontrei nenhuma solução.

Alguém poderia me dar uma luz sobre como resolver esse problema? Muito obrigado

No meu caso, apenas li postagens antigas e sei que estou tentando enviar mensagens para um canal privado. Então, substituí o nome do canal pelo ID do bate-papo e está funcionando perfeitamente!

Obrigado , Andriy e outros programadores profissionais <3

Andriy Voitenko
Andriy Voitenko
  • 2023.07.11
  • www.mql5.com
Trader's profile
 
Você pode explicar como posso ler as mensagens do meu próprio canal do Telegram? Há um bot conectado como administrador a esse canal, mas o texto da mensagem não pode ser retirado. Você poderia me dar uma dica?
 

No início desta semana, o arquivo Telegram.mqh está apresentando alguns problemas com as funções "ArrayAdd" e "WebRequest".

Alguém também está enfrentando esses problemas? Tentei adicionar novamente os arquivos originais, mas eles também parecem ter o mesmo problema.

'ArrayAdd' - no one of the overloads can be applied to the function call Telegram.mqh 149 10
could be one of 2 function(s) Telegram.mqh 149 10
   void CCustomBot::ArrayAdd(uchar&[],const uchar&[]) Telegram.mqh 120 22
   void CCustomBot::ArrayAdd(char&[],const string) Telegram.mqh 132 22

'WebRequest' - no one of the overloads can be applied to the function call Telegram.mqh 230 15
could be one of 2 function(s) Telegram.mqh 230 15
   built-in: int WebRequest(const string,const string,const string,const string,int,const char&[],int,char&[],string&) Telegram.mqh 230 15
   built-in: int WebRequest(const string,const string,const string,int,const char&[],char&[],string&) Telegram.mqh 230 15

'ArrayAdd' - no one of the overloads can be applied to the function call Telegram.mqh 737 7
could be one of 2 function(s) Telegram.mqh 737 7
   void CCustomBot::ArrayAdd(uchar&[],const uchar&[]) Telegram.mqh 120 22
   void CCustomBot::ArrayAdd(char&[],const string) Telegram.mqh 132 22

'ArrayAdd' - no one of the overloads can be applied to the function call Telegram.mqh 738 7
could be one of 2 function(s) Telegram.mqh 738 7
   void CCustomBot::ArrayAdd(uchar&[],const uchar&[]) Telegram.mqh 120 22
 
Henrique Felipini # No início desta semana, o arquivo Telegram.mqh está apresentando alguns problemas com as funções "ArrayAdd" e "WebRequest". Alguém também está enfrentando esses problemas? Tentei adicionar novamente os arquivos originais, mas eles também parecem ter o mesmo problema.

Tente com este arquivo

Arquivos anexados:
 
Lorentzos Roussos #:

tente com este arquivo

Eu estava recebendo alguns erros, por isso fiz 4 edições

      while(::StringReplace(text,"  "," ")>0);
      ::StringReplace(text,";"," ");
      ::StringReplace(text,","," ");
 
just these and another string function as well 
Arquivos anexados:
Telegram.mqh  85 kb