Created
August 14, 2020 00:39
-
-
Save HanzCEO/9c8ec20f70a35403133990754d4f10df to your computer and use it in GitHub Desktop.
intended to fix https://t.me/ehanaja 's problem so he/she can continue his/her project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from apscheduler.schedulers.blocking import BlockingScheduler | |
| JadwalSholat = { | |
| 'Shubuh': { | |
| 'idSholat': 1, | |
| 'title': 'Shubuh', | |
| 'hour': 4, | |
| 'minute': 30, | |
| 'text': 'Yok sholat shubuh yokkk!!!' | |
| }, | |
| 'Dzuhur': { | |
| 'idSholat': 2, | |
| 'title': 'Dzuhur', | |
| 'hour': 11, | |
| 'minute': 30, | |
| 'text': 'Yokk Dzuhur dulu baru lanjut lagi ngoding' | |
| }, | |
| 'Ashar': { | |
| 'idSholat': 3, | |
| 'title': 'Ashar', | |
| 'hour': 16, | |
| 'minute': 6, | |
| 'text': 'Asharnya jangan sampe kelewat' | |
| }, | |
| 'Maghrib': { | |
| 'idSholat': 4, | |
| 'title': 'Maghrib', | |
| 'hour': 17, | |
| 'minute': 40, | |
| 'text': 'Udah Maghrib berhenti dulu yuk' | |
| } # kurang Isya' | |
| } | |
| sched = BlockingScheduler() | |
| for item in JadwalSholat: | |
| job = JadwalSholat[item] | |
| def _job(job_instance): | |
| print(job_instance['title']) | |
| sched.add_job(_job, 'interval', args = [job], seconds = 10, name = job['title'], id = str(job['idSholat'])) | |
| sched.print_jobs() | |
| sched.start() | |
| """ | |
| Message from Hanz: | |
| Kamu tinggal kasih parameter keyword 'args' dengan value list(), | |
| jadi dengan itu data untuk ditampilkan sudah konstan dan tidak bisa dirubah | |
| Kerjamu bagus :D | |
| """ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment