-
Notifications
You must be signed in to change notification settings - Fork 5
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
Adjust auto-tagging #305
Adjust auto-tagging #305
Conversation
### Notes This PR removes the custom channel auto-tagging for `#hiring` channel while also some refactoring in order to account for empty arrays better, since before it relied on at least one entry there at all times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few notes/questions.
Co-authored-by: Antonio Salazar Cardozo <[email protected]>
This commits fixes up the `auto-join.ts` in favor of mapping, along with refactoring everything to make it smoother.
@Shadowfiend Just pushed a update with this feedback! Now it's much cleaner and switched interface in favor of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, let's
@@ -23,7 +23,11 @@ import { | |||
// it to mention the right role. Discord's behavior in this scenario is not to | |||
// ping the role, but to add all its members to the thread. | |||
|
|||
const CUSTOM_CHANNEL_ROLE = [{ channelName: "hiring", roleName: "PeopleOps" }] | |||
const CUSTOM_CHANNEL_ROLE: Record<string, string> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fwiw the one downside of Record<string, string>
is that it removes our ability to name either string. Whereas we could do:
const CUSTOM_ROLE_TAG_BY_CHANNEL: { [channelName: string]: string } = {
...
}
Mostly academic, but useful to know :) channelName
here does nothing other than provide a hint to the programmer as to what the key of the object is meant to be.
if (channelMatchingRole) { | ||
await placeholder.edit(channelMatchingRole.toString()) | ||
return | ||
if (hasCustomChannels && containingChannel) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way this control flows, we don't even need hasCustomChannels
—if there are no custom channels, roleName
will never pass if (roleName)
, and we'll continue to the following components.
Notes
This PR removes the custom channel auto-tagging for
#hiring
channel while also some refactoring in order to account for empty arrays better, since before it relied on at least one entry there at all times.