AsyncTelegram2 icon indicating copy to clipboard operation
AsyncTelegram2 copied to clipboard

Can't seem to figure out TBLocation?

Open dannyz2 opened this issue 9 months ago • 0 comments

I have the following code that checks for a valid msg.chat_id, and reports to me the unauthorized chat_id, and supposedly, their location. All I ever see for location, is "User is located @ -0.000000 , 0.000000" What am I doing wrong?

    if (myBot.getNewMessage(msg))           // if there is an incoming message...
    {
        if (ALLOWED_CHAT_IDS.find(msg.chatId) == ALLOWED_CHAT_IDS.end()) 
        {
            test = msg.chatId;
            float lat = msg.location.latitude;
            float lon = msg.location.longitude;
            myBot.sendMessage(msg, "Un-Authorized User!");
            Serial.print("User ");
            Serial.print(test);
            Serial.println(" is attempting to access Bot!");
            Serial.print("Chat_ID is: ");
            Serial.println(test);
            snprintf(welcome_msg, 384, "ChatID %lld is Attempting to access Bot!\n User is located @ %f , %f \n", test, lat, lon);
            myBot.sendTo(userid, welcome_msg); // Send a message to me about un-authorized user

            return;
        }

dannyz2 avatar Apr 25 '25 00:04 dannyz2