Skip to content

I can't handle any call back query from 4 days ago #1959

Description

@im03125

Please answer these questions before submitting your issue. Thanks!

  1. What version of pyTelegramBotAPI are you using?
    4.10
  2. What OS are you using?
    win 11
  3. What version of python are you using?
    python 3.9

im not a professional but this is my problem, please help,
I don't know why my bot can't handle any call back query any more,
but my bot was working very good and then it didn't respond to call back querys i updated my pytelegrambotapi but it still don;t respon any call back query,

this is the part of my code which i use for handle the querys,

@bot.callback_query_handler(func=lambda call: call.data == '8')
def upfornextripcmd(call):
userchatid = call.from_user.id
usertxt = call.message.text
mesid = call.message.message_id

mydb = mysql.connector.connect(
host="",
user="",
password="",
database="")

mycursor = mydb.cursor()

mycursor.execute("SELECT mesid FROM drcar1 WHERE drchatid = %s", (userchatid,))
mesid= mycursor.fetchone()[0]

try:
 message = bot.get_message(chat_id=userchatid, message_id=mesid)
 latitude = message.location.latitude
 longitude = message.location.longitude
 sql = ("UPDATE drcar1 SET drgeolocation=POINT(%s, %s) WHERE drchatid = %s")
 val = (latitude, longitude, userchatid)
 mycursor.execute(sql, val)
 mydb.commit()
 sql1=f"UPDATE drcar1 SET end = NULL WHERE drchatid='{userchatid}'"
 sql2=f"UPDATE drcar1 SET start = NULL WHERE drchatid='{userchatid}'"
 mycursor.execute(sql1,sql2)
 mydb.commit()
 bot.send_message(userchatid,"Your location updated successfully,please wait for requests,")


except:
    sql = f"DELETE FROM drcar1 WHERE drchatid = '{userchatid}'"
    mycursor.execute(sql)
    mydb.commit()
    sql = f"UPDATE users SET mood='1' WHERE chatid='{userchatid}'"
    mycursor.execute(sql)
    mydb.commit()

    drcarbtn=types.ReplyKeyboardMarkup(row_width=1)
    btnhome=types.KeyboardButton("Home")
    drcarbtn.add(btnhome)

    bot.send_message(userchatid,"Taxi/Driving/Car/Send your live location!Please",reply_markup=(drcarbtn))
mydb.close()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions