{"id":20838039,"url":"https://github.com/timcsy/timertaskbot","last_synced_at":"2026-04-24T17:01:17.764Z","repository":{"id":187409694,"uuid":"116099073","full_name":"timcsy/TimerTaskBot","owner":"timcsy","description":null,"archived":false,"fork":false,"pushed_at":"2018-01-03T14:51:21.000Z","size":192,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T09:44:09.778Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timcsy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-01-03T06:14:12.000Z","updated_at":"2018-01-03T06:25:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"1cce4ab5-42a4-467d-b83d-569a0e5cbc36","html_url":"https://github.com/timcsy/TimerTaskBot","commit_stats":null,"previous_names":["timcsy/timertaskbot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/timcsy/TimerTaskBot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timcsy%2FTimerTaskBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timcsy%2FTimerTaskBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timcsy%2FTimerTaskBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timcsy%2FTimerTaskBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timcsy","download_url":"https://codeload.github.com/timcsy/TimerTaskBot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timcsy%2FTimerTaskBot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32232613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T01:09:14.898Z","updated_at":"2026-04-24T17:01:17.729Z","avatar_url":"https://github.com/timcsy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TimerBot\n這是一個專門計時的聊天機器人\n\n## 設計理念\n原本想設計一個可以幫忙規劃時間的小秘書，但是因為住院所以時間不夠\n\n所以只做好了設定時間重複提醒的功能\n\n但其實這著功能也蠻好玩的\n\n玩法1：屁孩玩法，把機器人加到一個群聊，然後設定很多個task，人家就會吵死\n\n玩法2：提醒功能，當跟朋友聊天聊太久時會提醒你\n\n玩法3：工作時間規劃，打程式時適時提醒你準備結束、該休息了\n\n## 技術\n因為在使用webhook機制時會遇到一個問題，就是每次都要從頭開始，而且當遇到不同使用者的時候問題更大\n\n為了達到可以非同步處理不同使用者的訊息，我使用了[Actor Model](https://en.wikipedia.org/wiki/Actor_model)的概念\n\n在python中對應到的是 [Pykka](https://www.pykka.org/en/latest/) 這個library\n\n然後我也自己用threading.Timer搭配heapq實做了一個Scheduler\n\n此外可以為不同使用者顯示當前的fsm\n\n## 未來展望\n可多重輸入(不再是FSM而是Pushdown Automata或是Turing Mashine的機制)\n\n表單模組的建立\n\n結合資料庫 MongoDB\n\n可以結合Google日歷API設定行程\n\n安排行程建議\n\n行程分類\n\n檢討行程規劃\n\n自訂排班方式\n\n如果有興趣歡迎關注 https://github.com/timcsy/OPScheduleBot\n\n將會推出Telegram、Line、Messenger版本\n\nTelegram版本就是叫做 @OPScheduleBot\n\n## Setup\n\n### Prerequisite\n* Python 3\n* graphviz\n\n#### Install Dependency\n```sh\npip install -r requirements.txt\n```\n\n* pygraphviz (For visualizing Finite State Machine)\n    * [Setup pygraphviz on Ubuntu](http://www.jianshu.com/p/a3da7ecc5303)\n\n### Secret Data\n建立一個叫做 config.py 的檔案在主目錄下，內容為\n```\nTELEGRAM_API_TOKEN = 'YOUR_TELEGRAM_API_TOKEN'\nTELEGRAM_WEBHOOK_URL = 'YOUR_TELEGRAM_WEBHOOK_URL'\n```\t\n`TELEGRAM_API_TOKEN` and `TELEGRAM_WEBHOOK_URL` in .py **MUST** be set to proper values.\nOtherwise, you might not be able to run your code.\n\n### Run Locally\nYou can either setup https server or using `ngrok` as a proxy.\n\n**`ngrok` would be used in the following instruction**\n\n```sh\nngrok http 5000\n```\n\nAfter that, `ngrok` would generate a https URL.\n\nYou should set `TELEGRAM_WEBHOOK_URL` (in config.py) to `https://your-https-URL/hook`.\n\n#### Run the sever\n```sh\npython3 app.py\n```\n\n### Run on my Server\n\nFind @TimerTaskBot on the Telegram and you can run it if my server is opened. I have a server that can run for a long time.\n\n## Finite State Machine\n![fsm](./img/fsm.png)\n\n## Usage\n![](./images/2018-01-03-22-13-53.png)\n\nadd: to add a task\n\nenter interval (second):\n\n5 (for example)\n\n![](./images/2018-01-03-22-15-10.png)\n\ncancel: to cancel a task\n\nPlease enter the task number:\n\n0 (for example, enter the task's id)\n\n![](./images/2018-01-03-22-17-14.png)\n\nlist: list tasks\n\n![](./images/2018-01-03-22-16-09.png)\n\n\nrestart: to restart the scheduler\n\n![](./images/2018-01-03-22-17-36.png)\n\nfsm: to show the fsm picture\n\n![](./images/2018-01-03-22-18-00.png)\n\n## Author\n[張頌宇](https://github.com/timcsy)\n成大資訊系108級 F74046462\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimcsy%2Ftimertaskbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimcsy%2Ftimertaskbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimcsy%2Ftimertaskbot/lists"}