Does MQTT libraries working with Telegram bot libraries?

Does anyone tried before MQTT libraries with Telegram bot libraries together ? I have been tired it taking the subscribe message thru the topic and trying to sending a telegram message .

Message arrived in topic: smartdevice
Message:  welcome
-----------------------
Message arrived in topic: smartdevice
Message:  87
-----------------------
Message arrived in topic: smartdevice
Message:  welcome
-----------------------
Message arrived in topic: smartdevice
Message:  95
-----------------------

Those are the message i get from my MQTT.FX server and i was trying to do

String message = "Distance     ";
String numberString = message.substring(90); // How long "value    " is
if(numberString.toInt() > 80){
       sendTelegramMessage();  
}

However the function did not process to the sendTelegramMessage(); part it only continue printing the publishing sensor value.

String message = "Distance     ";

So, message is a string with no numbers in it...

String numberString = message.substring(90);

What do you think is in numberString? There is NO number in the string.

if(numberString.toInt() > 80){

What, EXACTLY, were you expecting "Distance " to evaluate to, as a number?

PaulS:

String message = "Distance     ";

So, message is a string with no numbers in it...

String numberString = message.substring(90);

What do you think is in numberString? There is NO number in the string.

if(numberString.toInt() > 80){

What, EXACTLY, were you expecting "Distance " to evaluate to, as a number?

forget to typing in it should be String messag = "Distance 94";
but is same problem

but is same problem

The "problem" is that you haven't bothered printing message, numberString, or the int valued by the call to the toInt() method, nor have you have you printed a message in the body of the if statement, so you are debugging by guesswork.

Debugging with facts takes about 10% as long. But, feel free to continue guessing what your program is, and is not, doing.

PaulS:
The "problem" is that you haven't bothered printing message, numberString, or the int valued by the call to the toInt() method, nor have you have you printed a message in the body of the if statement, so you are debugging by guesswork.

Debugging with facts takes about 10% as long. But, feel free to continue guessing what your program is, and is not, doing.

sorry paul,i have done the printing the value and the message , but during my mqtt subscriber been "client loop()" my telegram function is disable.