recursecenter / pairing-bot

A Zulip bot that partners people for pair programming practice
MIT License
22 stars 15 forks source link

refactor: Extract a Recurse client package #84

Closed jdkaplan closed 1 month ago

jdkaplan commented 2 months ago

The RC API client has enough complexity in it that I think it's worth putting it in its own package. Most of the code isn't specific to Pairing Bot, so I tried to leave most of that in the main package for now.

This is very similar to the Zulip client from #69, which I cleaned up a bit as I copy-pasted it into the new client.

Test Plan

Deploy this to the dev environment and check all the RC interactions:

Patch for pretending it's the second Tuesday of F1'24 (current batch) ```diff diff --git a/pairing_bot.go b/pairing_bot.go index 750a000..52bfeef 100644 --- a/pairing_bot.go +++ b/pairing_bot.go @@ -367,7 +367,7 @@ func (pl *PairingLogic) welcome(w http.ResponseWriter, r *http.Request) { break } - if currentBatch.IsSecondWeek(time.Now()) { + if currentBatch.IsSecondWeek( /*time.Now()*/ time.Date(2024, 8, 20, 18, 00, 00, 0, time.UTC)) { if err := pl.zulip.PostToTopic(ctx, "397 Bridge", "🍐🤖", getWelcomeMessage()); err != nil { log.Printf("Error when trying to send welcome message about Pairing Bot %s\n", err) } ```