| 187 | } |
| 188 | |
| 189 | async function downloadProfilePhoto(msg: Api.Message): Promise<Buffer | null> { |
| 190 | const replied = await safeGetReplyMessage(msg); |
| 191 | const fromId = replied?.senderId; |
| 192 | if (!fromId) { |
| 193 | await msg.edit({ text: "无法获取对方头像" }); |
| 194 | return null; |
| 195 | } |
| 196 | |
| 197 | const buf = (await msg.client?.downloadProfilePhoto(fromId, { |
| 198 | isBig: false, |
| 199 | })) as Buffer | undefined; |
| 200 | if (!buf) return null; |
| 201 | return buf; |
| 202 | } |
| 203 | |
| 204 | async function downloadMedia(msg: Api.Message): Promise<Buffer | null> { |
| 205 | const replied = await safeGetReplyMessage(msg); |