mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +00:00
Add milk carton missing member feature (!haveyouseenthem, !missing)
Generates milk carton style "missing person" PNG images using gg library with embedded Go fonts. Tracks inactive members via daily_activity, with configurable thresholds (MISSING_THRESHOLD_DAYS, MISSING_MAX_DAYS, MISSING_MIN_MESSAGES, MISSING_EXCLUDE_USERS). Rate limited to 1 carton per room per day. Derives flavor text characteristics from user stats and sentiment data. Avatar fetching with 3-tier fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -219,3 +219,24 @@ func (b *Base) UploadContent(data []byte, contentType, filename string) (id.Cont
|
||||
}
|
||||
return resp.ContentURI, nil
|
||||
}
|
||||
|
||||
// SendImage uploads image data and sends it as an m.image message with a caption.
|
||||
func (b *Base) SendImage(roomID id.RoomID, imgData []byte, filename, caption string, width, height int) error {
|
||||
uri, err := b.UploadContent(imgData, "image/png", filename)
|
||||
if err != nil {
|
||||
return fmt.Errorf("upload image: %w", err)
|
||||
}
|
||||
content := &event.MessageEventContent{
|
||||
MsgType: event.MsgImage,
|
||||
Body: caption,
|
||||
URL: uri.CUString(),
|
||||
Info: &event.FileInfo{
|
||||
MimeType: "image/png",
|
||||
Size: len(imgData),
|
||||
Width: width,
|
||||
Height: height,
|
||||
},
|
||||
}
|
||||
_, err = b.Client.SendMessageEvent(context.Background(), roomID, event.EventMessage, content)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user