Skip to content

Tan-18: Remind people who haven’t sent standup msg by EOD#938

Open
angelayu0530 wants to merge 1 commit into
mainfrom
TAN-18
Open

Tan-18: Remind people who haven’t sent standup msg by EOD#938
angelayu0530 wants to merge 1 commit into
mainfrom
TAN-18

Conversation

@angelayu0530

Copy link
Copy Markdown
Contributor

Description of changes

Checklist before review

  • I have done a thorough self-review of the PR
  • Copilot has reviewed my latest changes, and all comments have been fixed and/or closed.
  • If I have made database changes, I have made sure I followed all the db repo rules listed in the wiki here. (check if no db changes)
  • All tests have passed
  • I have successfully deployed this PR to staging
  • I have done manual QA in both dev (and staging if possible) and attached screenshots below.

Screenshots

Dev

Staging

@angelayu0530
angelayu0530 requested a review from a team as a code owner July 19, 2026 19:01
@github-actions

Copy link
Copy Markdown
Contributor

Available PR Commands

  • /ai - Triggers all AI review commands at once
  • /review - AI review of the PR changes
  • /describe - AI-powered description of the PR
  • /improve - AI-powered suggestions
  • /deploy - Deploy to staging

See: https://github.com/tahminator/codebloom/wiki/CI-Commands

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

};

const INTENTS: GatewayIntents = GatewayIntents::GUILD_MEMBERS;
const INTENTS: GatewayIntents = GatewayIntents::GUILD_MEMBERS.union(GatewayIntents::GUILD_MESSAGES);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: its more idiomatic in rust to use the | operator for bitflags. if you're curious (ik i was the first time i looked at it), the syntax is provided by the bitflags crate which allows callers to select multiple options of something.

.await
.inspect_err(|e| println!("Error creating thread: {e:#?}"))
.map(|_| ())
.inspect_err(|e| println!("Error creating thread: {e:#?}"))?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can probably avoid the error inspection now that we return if Err (which is done by the ? type automatically. see here).

Comment on lines +100 to +104
if let Err(e) = redis::client::set_standup_thread_id(thread.id.get()).await {
println!("Failed to persist standup thread id: {e:#?}");
}

Ok(())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah honestly i handled errors really poorly, could do with a rewrite using thiserror :/ but for now, you can have it print (should probably use eprintln for errors, though ik this section was already doing it incorrectly) and then return the error via ? operator.

@tahminator tahminator Jul 20, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on second glance, this is really not great on my part 😅
i made a lot of mistakes here that i now realize are not idiomatic. i wont block the pr on any of it, but ill try & fix it up afterwards (+ log some tickets for the team to do so as well)

Comment on lines +107 to +126
pub async fn get_standup_role_members(guild_id: u64) -> Result<Vec<Member>, Error> {
let guild = GuildId::new(guild_id);
let role = RoleId::new(ROLE_ID);
let mut result = Vec::new();
let mut after: Option<UserId> = None;

loop {
let batch = guild.members(get_http().as_ref(), Some(1000), after).await?;
let batch_len = batch.len();
after = batch.last().map(|m| m.user.id);

result.extend(batch.into_iter().filter(|m| m.roles.contains(&role)));

if batch_len < 1000 {
break;
}
}

Ok(result)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: this will probably get us rate-limited pretty fast. it might be a better idea to enable serenity's cache feature (we use something similar with the Java Discord lib within Codebloom)

let guild = GuildId::new(guild_id);
let role = RoleId::new(ROLE_ID);
let mut result = Vec::new();
let mut after: Option<UserId> = None;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you probably didnt know this but the rust compiler can actually look ahead and infer that after must be Option<UserId> which is pretty sick! You can use this for vectors too, something along the lines of

let items = vec![];

items.push(String::from("hello world"));

// it is clear to the rust compiler that items is Vec<String> and will backfill said type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants