(msg: Api.Message)
| 99 | } |
| 100 | |
| 101 | private async handleAutoDel(msg: Api.Message): Promise<void> { |
| 102 | const args = msg.message.split(" ").slice(1); |
| 103 | |
| 104 | if (args.length === 0 || args[0] === "h") { |
| 105 | await msg.edit({ |
| 106 | text: this.getHelpText(), |
| 107 | parseMode: "html" |
| 108 | }); |
| 109 | return; |
| 110 | } |
| 111 | |
| 112 | if (args[0] === "l") { |
| 113 | await this.showAutoDelSettings(msg); |
| 114 | return; |
| 115 | } |
| 116 | |
| 117 | if (args[0] === "cancel") { |
| 118 | await this.cancelAutoDelSetting(msg, args.includes("global")); |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | const timeStr = args[0]; |
| 123 | const isGlobal = args.includes("global"); |
| 124 | |
| 125 | const delaySeconds = this.parseTimeString(timeStr); |
| 126 | if (delaySeconds === null) { |
| 127 | await msg.edit({ |
| 128 | text: "❌ 时间格式错误,请使用如:30 seconds, 5 minutes, 2 hours, 1 days" |
| 129 | }); |
| 130 | return; |
| 131 | } |
| 132 | |
| 133 | // 设置自动删除配置 |
| 134 | await this.setAutoDelSetting(msg, delaySeconds, isGlobal); |
| 135 | } |
| 136 | |
| 137 | private getHelpText(): string { |
| 138 | return `📝 <b>定时删除消息帮助</b>\n\n` + |
nothing calls this directly
no test coverage detected