Ejemplo n.º 1
0
	while True:
		asking=True
		try:
			print("Polling Started")
			time.sleep(1)
			bot.polling()

		except KeyboardInterrupt:
			#Exit
			while asking:
				try:
					close=input("Are you sure you want to close? [y]/[n]: \n")

					if(close=="y"):
						print("Cleaning up...")
						db.back_up()
						db.connection.close()
						asking = False
						sys.exit()
					else:
						asking = False
						pass
				except (EOFError, KeyboardInterrupt):
					pass
		except Exception as e:
			print(f"Error '{e}' occurred.")
			try:
				send_error(e)
			except Exception as e:
				print(e)
			time.sleep(10)