import telepot import session as ses import sys from functions import getChampionRanks from functions import getPlayer from send_the_message import sendMessage ses.main() chat_id = sys.argv[1] if __name__ == "__main__": # Checking if the player is actually valid because # Node-RED sends Undefined when param not provided unauthorized = ['Undefined', 'undefined'] player_arg = sys.argv[2] if player_arg in unauthorized : message = "Enter a player name" sendMessage(chat_id, message) exit() else : # Now running the real shit player_name = getPlayer(player_arg)['Name'] champions = getChampionRanks(player_arg) count = 1 arr_val = 0 while count <= 5 :
# Default logger settings logging.basicConfig( level=logging.ERROR, format='%(asctime)s (%(module)s) [%(levelname)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S' ) # Main program flow if __name__ == '__main__': while True: try: # Initialize welcome screen and session settings session.initialize() logging.debug("Session successfully initialized") # Start the main session flow session.main() logging.debug("Session successfully finished!") except Exception as e: logging.exception("Error occurred! Error message:") finally: choice = str(input("\n[y/n] Would you like to restart the session?\n")) if choice.lower() == 'y': logging.info("Session restarted") pass elif choice.lower() == 'n': logging.info("Session completed, shutting down...") break # Clear the screen before finishing the program session.clear()