(msg: Api.Message)
| 241 | |
| 242 | if (!replyMsg) { |
| 243 | await msg.edit({ |
| 244 | text: "❌ <b>请回复一条消息以保存新的Aff信息</b>", |
| 245 | parseMode: "html" |
| 246 | }); |
| 247 | return; |
| 248 | } |
| 249 | |
| 250 | const text = replyMsg.text || replyMsg.message || ""; |
| 251 | |
| 252 | if (!text.trim()) { |
| 253 | await msg.edit({ |
| 254 | text: "❌ <b>回复的消息内容为空</b>\n\n" + |
| 255 | "💡 请回复一条包含aff信息的消息", |
| 256 | parseMode: "html" |
| 257 | }); |
| 258 | return; |
| 259 | } |
| 260 | |
| 261 | // 检测是否包含网页预览(简单的URL检测) |
| 262 | const hasWebPage = /https?:\/\/[^\s]+/.test(text); |
| 263 | |
| 264 | await this.addAff(text, hasWebPage); |
| 265 | |
| 266 | const affs = await this.getAffs(); |
| 267 | await msg.edit({ |
| 268 | text: `✅ <b>Aff信息保存成功!</b>\n🆔 当前序号:${affs.length}`, |
| 269 | parseMode: "html" |
| 270 | }); |
| 271 | } |
| 272 | |
| 273 | // 删除aff信息 |
| 274 | private async handleRemove(msg: Api.Message, param?: string): Promise<void> { |
| 275 | if (!param) { |
| 276 | await msg.edit({ |
| 277 | text: `❌ <b>请指定要删除的序号</b>\n💡 例如:<code>${mainPrefix}aff remove 1</code>`, |
| 278 | parseMode: "html" |
no test coverage detected