(msg: Api.Message)
| 295 | if (!chatId) { |
| 296 | await msg.edit({ text: "❌ 无法获取聊天ID", parseMode: "html" }); |
| 297 | return; |
| 298 | } |
| 299 | |
| 300 | // 检查权限 |
| 301 | const hasPermission = await this.checkPermission(msg); |
| 302 | if (!hasPermission) { |
| 303 | await msg.edit({ |
| 304 | text: "❌ 权限不足,无法操作整点报时", |
| 305 | parseMode: "html" |
| 306 | }); |
| 307 | return; |
| 308 | } |
| 309 | |
| 310 | // 检查是否已订阅 |
| 311 | if (!this.db.data.subscriptions.includes(chatId)) { |
| 312 | await msg.edit({ |
| 313 | text: "❌ 你还没有订阅整点报时", |
| 314 | parseMode: "html" |
| 315 | }); |
| 316 | return; |
| 317 | } |
| 318 | |
| 319 | // 移除订阅 |
| 320 | this.db.data.subscriptions = this.db.data.subscriptions.filter((id: string) => id !== chatId); |
| 321 | delete this.db.data.lastMessages[chatId]; |
| 322 | await this.db.write(); |
| 323 | |
| 324 | await msg.edit({ |
| 325 | text: "✅ 你已经成功退订了整点报时", |
| 326 | parseMode: "html" |
| 327 | }); |
| 328 | } |
| 329 | |
| 330 | // 处理列表查看 |
| 331 | private async handleList(msg: Api.Message) { |
| 332 | const chatId = msg.chatId?.toString(); |
| 333 | if (!chatId) { |
| 334 | await msg.edit({ text: "❌ 无法获取聊天ID", parseMode: "html" }); |
| 335 | return; |
no test coverage detected