{"id":16855124,"url":"https://github.com/stageguard/supercoursetimetablebot","last_synced_at":"2025-03-17T05:32:17.314Z","repository":{"id":40690020,"uuid":"311959976","full_name":"StageGuard/SuperCourseTimetableBot","owner":"StageGuard","description":"基于 mirai-console 的 超级课表上课提醒QQ机器人 插件","archived":false,"fork":false,"pushed_at":"2022-12-15T08:51:27.000Z","size":715,"stargazers_count":89,"open_issues_count":6,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T08:31:40.253Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StageGuard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-11T12:10:08.000Z","updated_at":"2025-03-04T03:03:29.000Z","dependencies_parsed_at":"2023-01-29T02:25:11.584Z","dependency_job_id":null,"html_url":"https://github.com/StageGuard/SuperCourseTimetableBot","commit_stats":null,"previous_names":["konnyakucamp/supercoursetimetablebot"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StageGuard%2FSuperCourseTimetableBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StageGuard%2FSuperCourseTimetableBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StageGuard%2FSuperCourseTimetableBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StageGuard%2FSuperCourseTimetableBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StageGuard","download_url":"https://codeload.github.com/StageGuard/SuperCourseTimetableBot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243981353,"owners_count":20378564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-10-13T13:58:32.214Z","updated_at":"2025-03-17T05:32:16.448Z","avatar_url":"https://github.com/StageGuard.png","language":"Kotlin","readme":"# SuperCourseTimetableBot\n\n一个基于 [mirai](https://github.com/mamoe/mirai/) 和 [mirai-console](https://github.com/mamoe/mirai-console) 的 超级课程表 提醒 mirai-console 插件。\n\n![Gradle CI Status](https://github.com/StageGuard/SuperCourseTimetableBot/workflows/Gradle%20CI/badge.svg) [![CodeFactor](https://www.codefactor.io/repository/github/stageguard/supercoursetimetablebot/badge)](https://www.codefactor.io/repository/github/stageguard/supercoursetimetablebot)\n## 特性\n\n\u003cimg align=\"right\" src=\"static/screenshot1.png\" height=\"300\"\u003e\n\n- #### Interactive Conversation Mode - 交互式聊天模式的用户接口\n\n抛弃了传统的命令式交互，采用了更友好的交互式聊天模式。\n\n- #### 允许用户更方便地修改时间表信息\n\n可能超级课表上的作息时间表与学校不吻合，用户可以发送 **修改时间表** 来修改。\n\n在 交互式聊天模式 的优势下，修改时间表的步骤变得非常容易。\n\n- #### 允许用户自定义提醒时间\n\n用户发送 **修改提前提醒时间** 即可通过步骤引导修改。\n\n- #### 适配几乎所有使用超级课程表的高校\n\n\u003cimg align=\"right\" src=\"static/screenshot2.png\" height=\"300\"\u003e\n\n插件工作时，为每个正在使用的用户的高校分别计算当前周数和时间表，互不冲突。\n\n- #### 数据库存储数据\n\n使用 [MySQL](https://www.mysql.com/), [MariaDB](https://mariadb.org/) 或 [SQLite](https://www.sqlite.org/index.html) 存储用户的数据，当用户数量较多时依然保持良好的数据读取性能。\n\n## 使用\n\n### 立即体验\n\n~~添加 QQ好友：xxxxxxxxx，将会自动同意好友请求并发送提示。~~\n\n不再提供样例账号，请自行部署。\n\n\u003e 我的高校不使用超级课表APP，但是我也想试试这个 BOT：\u003cbr\u003e\n\u003e - 超级课程表APP 适配了国内大部分高校的教务系统，你可以尝试下载 APP，同步你的高校的课表。\n\u003e 若可以获取课表信息，那么恭喜你，这个 BOT 你也可以使用。\n\n### 部署\n\nSuperCourseTimetableBot 是**基于 `mirai-core 2.x` 版本和 `mirai-console 2.x` 版本的插件，不兼容 1.x 版本**。\n\n1. 运行一个新的或使用现有的 MySQL, MariaDB 或 SQLite 数据库。\n2. 在 [Releases](https://github.com/StageGuard/SuperCourseTimetableBot/releases/) 中下载 `SCTimetableBot-x.x.mirai.jar` 将其放入 mirai-console 的 插件文件夹下。\n3. 插件默认使用 SQLite 嵌入式数据库，启动 mirai-console，会有如下提示。\n\n```\n2021-12-21 11:18:41 I/SuperCourseTimetable: Plugin loaded\n2021-12-21 11:18:41 I/SuperCourseTimetable: Database is connected.\n2021-12-21 11:18:41 I/SuperCourseTimetable: Waiting target Bot 123456789 goes online...\n```\n\n4. 停止运行 mirai-console，进入 SuperCourseTimetableBot 配置文件 `config/SuperCourseTimetable/SG.SCTimeTableBotConfig.yml`，按照如下提示修改配置。\n\n```yaml\n# 用于工作的BOT的QQ号\nqq: 123456789\n# 默认提前多长时间提醒(单位：分钟)。\n# 此值会在用户第一次被添加进数据库时设置给这个用户。\n# 注意：如果你修改了这个值，在修改之前已经被设置的用户和自己设定值的用户不会受到影响。\nadvancedTipTime: 15\n# 使用的数据库类型，支持 MySQL / MariaDB / SQLite\n# 填 `mysql` 表示使用 MySQL 或 MariaDB。\n# 填 `sqlite` 表示使用 SQLite。\n# 填其他字符为无效选项。\n# 当使用其中一个数据库类型时，另一个数据库配置不会生效。\ndatabase: sqlite\n# MySQL / MariaDB 数据库配置。\n# 若使用此数据库类型，请先手动创建数据库：\n# create database `sctimetabledb`;\n# 或其他你在下方 table 中指定的数据库名称。\nmysqlConfig:\n  address: localhost\n  user: root\n  password: ''\n  table: sctimetabledb\n  maximumPoolSize: 10\n# SQLite 数据库配置。\nsqliteConfig:\n  # SQLite 数据库文件。\n  file: sctimetable.db\n```\n\n5. 重新运行 mirai-console，登录在第四步配置中指定的账号，SuperCourseTimetableBot 会输出如下提示：\n\n```\n2020-12-19 12:39:07 I/SuperCourseTimetable: TimeProviderService: Job YearUpdater is executed. (currentYear -\u003e 2020)\n2020-12-19 12:39:07 I/SuperCourseTimetable: TimeProviderService: Job SemesterUpdater is executed. (currentSemester -\u003e 1)\n2020-12-19 12:39:07 I/SuperCourseTimetable: ScheduleListenerService: Notification distribution job has executed.\n2020-12-19 12:39:07 I/SuperCourseTimetable: TimeProviderService: Job SchoolWeekPeriodUpdater is executed.\n```\n\n这时 SuperCourseTimetableBot 就已经成功工作了。\n\n\u003e 注意：请确保运行 mirai-console 宿主机的时区和数据库时区是 `Asia/Shanghai` 并已同步北京时间！详见 [#4](https://github.com/StageGuard/SuperCourseTimetableBot/issues/4) 。\n\n## 稳定性\n\nSuperCourseTimetableBot 并未经过长期运行测试，对于其 `Quartz` 任务触发是否错误，我们暂时无法得知。\n\n建议将 mirai-console 的日志等级调整为 `ALL`，以便捕获问题。\n\n\u003e 在调整日志等级为 `ALL` 后 HikariCP 和 Quartz 库在每10秒就输出一次日志：\n\u003e\n\u003e ```\n\u003e 2020-xx-xx xx:xx:Xx D/com.zaxxer.hikari.pool.HikariPool: HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)\n\u003e 2020-xx-xx xx:xx:Xx D/com.zaxxer.hikari.pool.HikariPool: HikariPool-1 - Fill pool skipped, pool is at sufficient level.\n\u003e 2020-xx-xx xx:xx:Xx D/org.quartz.core.QuartzSchedulerThread: batch acquisition of 0 triggers\n\u003e ```\n\u003e\n\u003e 它的输出过于频繁，会遮盖住 `SuperCourseTimetableBot` 的输出，你可以在 console 的配置文件添加如下配置：\n\u003e\n\u003e ```yaml\n\u003e loggers:\n\u003e   org.quartz.core.QuartzSchedulerThread: NONE\n\u003e   com.zaxxer.hikari.pool.HikariPool: NONE\n\u003e ```\n\u003e\n\u003e 来禁用它们的输出。\n\n如有任何问题，请立即新建一个 ISSUE 来反馈，我们非常需要知道是否有稳定性问题。\n\n## 工作原理 \u0026 源码解析\n\n如果你想了解 SuperCourseTimetableBot 是如何工作的，请阅读 [SuperCourseTimetableBot 代码结构解析](source-analyze.md)。\n\n## TODO(\"\")\n\n- [x] 手动修改时间表\n- [x] 在时间表被修改时通知本校其他用户\n- [ ] 支持手动添加课程(补课或永久调整的课程)\n- [ ] ~~使用 `Mozilla Rhino` 通过动态 `JavaScript` 来适配不同的教务系统~~\n\n## 开发计划\n\nSuperCourseTimetableBot 插件将会在 `1.0` 版本允许动态适配不同教务系统(详见上方 `TODO` 第四条)，完全重构 `RequestHandlerService` 和 `BotRouteEventService`，并实现 自定义文本/自定义语音/自定义图片 提醒。\n\n## 贡献\n\n欢迎任何~~使用者~~大佬们贡献这个项目，你可以通过**反馈 BUG**，**提出 Pull Request** 申请，~~或修改文档错别字~~来贡献这个项目。\n\n\u003e 如果你有贡献这个项目的想法，建议你先浏览一下上面的代码结构解析。\n\n## 使用的开源库\n\n- [mirai](https://github.com/mamoe/mirai/) - 高效率 QQ 机器人框架 / High-performance bot framework for Tencent QQ.\n- [mirai-console](https://github.com/mamoe/mirai-console) - mirai 的高效率 QQ 机器人控制台.\n- [Exposed](https://github.com/JetBrains/Exposed) - A Kotlin SQL Framework.\n- [HikariCP](https://github.com/brettwooldridge/HikariCP) - 光 HikariCP・A solid, high-performance, JDBC connection pool at last.\n- [Quartz](https://github.com/quartz-scheduler/quartz) - A richly featured, open source job scheduling library.\n- [yamlkt](https://github.com/Him188/yamlkt) - Multiplatform YAML parser \u0026 serializer for kotlinx.serialization written in pure Kotlin.\n\n## 许可证协议\n\n```\nSuperCourseTimetableBot\nCopyright (C) 2020-2021 StageGuard\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as published\nby the Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstageguard%2Fsupercoursetimetablebot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstageguard%2Fsupercoursetimetablebot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstageguard%2Fsupercoursetimetablebot/lists"}