A Zulip bot agent to sit in our Black Sun. Ever evolving
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Skip past days with existing files, verify admin via delivery_email

monopam:
- Make --aggregate the default for daily changes (add --no-aggregate to skip)
- Skip past days entirely if per-day file exists to avoid redundant Claude calls
- For today, still check if entry exists before regenerating
- Simplify Zulip format headers ("Updates for..." instead of "## Changes for...")

poe:
- Fix admin verification to use delivery_email from Zulip API
- Fallback to sender_email if API call fails

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+19 -3
+19 -3
lib/handler.ml
··· 111 111 Log.info (fun m -> m "Claude response: %s" response); 112 112 Zulip_bot.Response.reply response 113 113 114 - let is_admin config email = 115 - List.mem email config.Config.admin_emails 114 + let is_admin config ~storage msg = 115 + let sender_id = Zulip_bot.Message.sender_id msg in 116 + let client = Zulip_bot.Storage.client storage in 117 + try 118 + let user = Zulip.Users.get_by_id client ~user_id:sender_id () in 119 + let delivery_email = Zulip.User.delivery_email user in 120 + let email = Zulip.User.email user in 121 + (* Check both delivery_email (actual email) and email (Zulip internal) *) 122 + let emails_to_check = 123 + match delivery_email with 124 + | Some de -> [ de; email ] 125 + | None -> [ email ] 126 + in 127 + List.exists (fun e -> List.mem e config.Config.admin_emails) emails_to_check 128 + with _ -> 129 + (* Fallback to sender_email from message if API call fails *) 130 + let sender_email = Zulip_bot.Message.sender_email msg in 131 + List.mem sender_email config.Config.admin_emails 116 132 117 133 let make_handler env config = 118 134 fun ~storage ~identity msg -> ··· 131 147 | Commands.Broadcast -> 132 148 Broadcast.run ~fs:env.fs ~storage ~config 133 149 | Commands.Admin cmd -> 134 - if is_admin config sender_email then 150 + if is_admin config ~storage msg then 135 151 Zulip_bot.Response.reply (Admin.handle ~storage cmd) 136 152 else 137 153 Zulip_bot.Response.reply "Admin commands require authorization. Contact an admin to be added to the admin_emails list."