Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. def error(bot, update, error):
  2.     try:
  3.         logger.warn('Update "%s" caused error "%s"' % (update, error))
  4.         raise error
  5.     except Unauthorized:
  6.         db = mysql.connector.connect(user='root', password='', host='localhost', database='ict_telegram')
  7.         cursor = db.cursor(buffered=True)
  8.         delete_user = ("DELETE FROM users WHERE chatid = '%s'" % (update.message.chat_id))
  9.         cursor.execute(delete_user)
  10.         db.commit()
  11.         cursor.close()
  12.         db.close()
  13.     #except BadRequest:
  14.         # handle malformed requests - read more below!
  15.     #except TimedOut:
  16.         # handle slow connection problems
  17.     #except NetworkError:
  18.         # handle other connection problems
  19.     #except ChatMigrated as e:
  20.         # the chat_id of a group has changed, use e.new_chat_id instead
  21.     #except TelegramError:
  22.         # handle all other telegram related errors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement