Untitled
def send_reddit_message(message_number): message = f"Message for r/LigaMX: {message_number}" try: # Send the message reddit.redditor('MatchThreadder').message('Match Thread', message) print(f"Message sent: {message}") except Exception as e: print(f"An error occurred: {e}") # Clear any existing schedules schedule.clear() # Schedule messages based on the lists for i in range(len(message_numbers)): if i < len(schedules): # Ensure there is a corresponding schedule for each message schedule.every().day.at(schedules[i]).do(send_reddit_message, message_number=message_numbers[i]) else: print(f"No schedule time provided for message number {message_numbers[i]}") # Keep the script running while True: schedule.run_pending() time.sleep(1)
Leave a Comment