(target: SignTarget)
| 444 | |
| 445 | const startMinutes = startH * 60 + startM; |
| 446 | let endMinutes = endH * 60 + endM; |
| 447 | |
| 448 | if (endMinutes < startMinutes) { |
| 449 | endMinutes += 24 * 60; |
| 450 | } |
| 451 | |
| 452 | if (endMinutes <= startMinutes) { |
| 453 | return conf.runTime; |
| 454 | } |
| 455 | |
| 456 | const randomMinute = startMinutes + Math.floor(Math.random() * (endMinutes - startMinutes)); |
| 457 | const finalMinutes = randomMinute >= 24 * 60 ? randomMinute - 24 * 60 : randomMinute; |
| 458 | const hours = Math.floor(finalMinutes / 60); |
| 459 | const minutes = finalMinutes % 60; |
| 460 | |
| 461 | return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`; |
| 462 | } |
| 463 | |
| 464 | private async runAllSigns(source: string, fallbackPeer?: any, statusMsg?: Api.Message): Promise<void> { |
| 465 | const client = await getGlobalClient(); |
| 466 | if (!client) return; |
| 467 | const conf = this.cfg.get(); |
| 468 | const enabled = conf.targets.filter((t) => t.enabled); |
| 469 | if (!enabled.length) { |
| 470 | if (statusMsg) await this.edit(statusMsg, "❌ 没有启用的签到目标"); |
| 471 | return; |
| 472 | } |
no test coverage detected