job.py 646 B

1234567891011121314151617181920212223242526272829
  1. """Scheduler class"""
  2. import os
  3. from app import scheduler, DiscordClient
  4. def add_send_code():
  5. """Send code to user"""
  6. job = scheduler.get_job("send_code")
  7. print("hi")
  8. if job is None:
  9. job = scheduler.add_job(
  10. id="send_code",
  11. func=run_send_code,
  12. trigger="date",
  13. )
  14. def run_send_code():
  15. """Upgrade to new version"""
  16. discord_client = DiscordClient()
  17. discord_client.run(os.environ["DISCORD_TOKEN"])
  18. discord_channel = client.get_channel(373000514608300034)
  19. discord_channel.send('hello')
  20. if __name__ == "__main__":
  21. run_send_code.__module__ = "scheduler"