Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nickname change event for OOO #318

Merged
merged 5 commits into from
Nov 1, 2024
Merged

Add nickname change event for OOO #318

merged 5 commits into from
Nov 1, 2024

Conversation

zuuring
Copy link
Member

@zuuring zuuring commented Oct 25, 2024

  • fixes THESIS-101

Notes

This is the main working PR for building out the nickname changer as setup by a webhook call into Valkyrie. It's hardcoded to have OOO, which we can also alter to pass rather than embed.

To-Do

  • Setup initial flow to map nickname
  • Map userID to matched nickname

### Notes
This is the main working PR for building out the nickname changer as setup by a webhook call into Valkyrie.

### To-Do
-[] Setup initial flow to map nickname
-[] Map userID to matched nickname
@zuuring zuuring marked this pull request as ready for review October 30, 2024 11:41
Copy link
Contributor

@Shadowfiend Shadowfiend left a comment

Choose a reason for hiding this comment

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

Generally looks good, a few things we should do in terms of code quality/refactoring but nothing blocking. Let's ship and iterate 🚢

Comment on lines +62 to +65
// WIP, output list of all members for matching
guild.members.cache.forEach((member) => {
robot.logger.info(`Username: ${member.user.username}`)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we drop those?

Also wondering if we need to start wrapping stuff in an environment check.

})

const matchedMember = guild.members.cache.find((member) =>
member.user.username.includes(username),
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we be looking for a direct (case-insensitive) match here?

return matchedMember ? matchedMember.user.id : null
}

async function updateServerNickname(
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't just about updating the server nickname since it does all the OOO stuff, right? Let's be very specific about what this function does in the name.

@@ -97,5 +154,37 @@ export default async function webhookDiscord(
},
)
robot.logger.info("Webhook is now enabled")

robot.router.post("/start-date", handleAuth, async (req, res) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should look at scoping this very specifically and making it a little more REST-like. Something like:

robot.router.post(`${webhookUrl}/user/:username/out-of-office`...

robot.router.delete(`${webhookUrl}/user/:username/out-of-office`...

Copy link
Contributor

Choose a reason for hiding this comment

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

(I say this not remembering what webhookUrl is. We should also probably scope the message poster webhook to /message or similar.)

@Shadowfiend Shadowfiend merged commit e0db762 into main Nov 1, 2024
7 checks passed
@Shadowfiend Shadowfiend deleted the nickname-change branch November 1, 2024 16:07
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