My agentic slop goes here. Not intended for anyone else!
1(* Simple Bot Example using core Zulip library *)
2
3let () =
4 Printf.printf "OCaml Zulip Bot Example\n";
5 Printf.printf "=======================\n\n";
6
7 (* Create test authentication *)
8 let auth = Zulip.Auth.create
9 ~server_url:"https://example.zulipchat.com"
10 ~email:"bot@example.com"
11 ~api_key:"example-api-key" in
12
13 Printf.printf "✅ Created authentication for: %s\n" (Zulip.Auth.email auth);
14 Printf.printf "✅ Server URL: %s\n" (Zulip.Auth.server_url auth);
15
16 (* Create client *)
17 let client = Zulip.Client.create () auth in
18 let client_str = Format.asprintf "%a" Zulip.Client.pp client in
19 Printf.printf "✅ Created client: %s\n" client_str;
20
21 (* Test message creation *)
22 let message = Zulip.Message.create
23 ~type_:`Channel
24 ~to_:["general"]
25 ~content:"Hello from OCaml bot!"
26 ~topic:"Bot Testing"
27 () in
28
29 Printf.printf "✅ Created message to: %s\n" (String.concat ", " (Zulip.Message.to_ message));
30 Printf.printf "✅ Message content: %s\n" (Zulip.Message.content message);
31 Printf.printf "✅ Message topic: %s\n" (match Zulip.Message.topic message with Some t -> t | None -> "none");
32
33 (* Test API call (mock) *)
34 (match Zulip.Client.request client ~method_:`GET ~path:"/users/me" () with
35 | Ok response ->
36 Printf.printf "✅ API request successful: %s\n"
37 (match response with
38 | `O fields -> String.concat ", " (List.map fst fields)
39 | _ -> "unknown format")
40 | Error err ->
41 Printf.printf "❌ API request failed: %s\n" (Zulip.Error.message err));
42
43 Printf.printf "\n🎉 Bot example completed successfully!\n";
44 Printf.printf "Note: This uses mock responses since we're not connected to a real Zulip server.\n"