(
msg: Api.Message,
trigger: Api.Message | undefined,
chatKey: string
)
| 879 | const jobs = [...this.jobs.values()].filter((job) => job.chatKey === chatKey); |
| 880 | if (jobs.length === 0) { |
| 881 | await respondToCommand(msg, trigger, { text: "当前没有等待自动解除的临时管理员" }); |
| 882 | return; |
| 883 | } |
| 884 | |
| 885 | const now = Date.now(); |
| 886 | const lines = jobs.map((job) => { |
| 887 | const remainingMinutes = Math.max(0, Math.ceil((job.expiresAt - now) / 60_000)); |
| 888 | return `- ${job.userDisplay} | 剩余 ${codeTag(`${remainingMinutes} 分钟`)}`; |
| 889 | }); |
| 890 | |
| 891 | await respondToCommand(msg, trigger, { |
| 892 | text: `当前临时管理员:\n${lines.join("\n")}`, |
| 893 | parseMode: "html", |
| 894 | }); |
| 895 | } |
| 896 | |
| 897 | private async getCurrentParticipantOrThrow( |
| 898 | channel: any, |
| 899 | targetEntity: any |
| 900 | ): Promise<any> { |
| 901 | const client = await getGlobalClient(); |
| 902 | const info = await client.invoke( |
| 903 | new Api.channels.GetParticipant({ |
| 904 | channel, |
| 905 | participant: targetEntity, |
no test coverage detected