-
Notifications
You must be signed in to change notification settings - Fork 8
[feature] Automatically open threads for messages in specific channels #164
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
base: master
Are you sure you want to change the base?
Conversation
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.
I love the demo GIF! I like your style.
src/bots/monitor/index.js
Outdated
// Verify a resume is attached to message | ||
if (message.attachments.size === 0) { | ||
author.send(defaultStrings.noResume); | ||
message.delete(); | ||
return; | ||
} | ||
|
||
// Verify that all attachments are in valid format for a resume | ||
if (!message.attachments.every((file) => attachmentIsAllowed(file))) { | ||
author.send(defaultStrings.invalidFormat); | ||
message.delete(); | ||
return; | ||
} |
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 DM should include the text the user posted and which got deleted. This way, if they had written a massive wall-of-text, it's not lost.
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.
Great idea, I'll add that to the next revision
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.
Looks great! I added some feedback on some lines I thought you could expand your implementation.
src/bots/monitor/index.js
Outdated
// Run routine based on id | ||
switch (message.channelId) { | ||
// Career questions channel | ||
case get('CAREER_QUESTIONS_CHANNEL_ID'): |
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.
Consider adding a case for when a person replies to another message at the top-level instead of in a thread. (as a reply instead of as a standalone message). Also consider returning the message they sent in the dm you send them.
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.
That's a really smart idea, will do both. Thanks!
src/bots/monitor/index.js
Outdated
|
||
// Verify that all attachments are in valid format for a resume | ||
if (!message.attachments.every((file) => attachmentIsAllowed(file))) { | ||
author.send(defaultStrings.invalidFormat); |
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.
Consider sending the author of the invalid message a copy of their message when you delete it so they can repost it easily with the correct format.
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.
That would save a lot of frustration. Will add that in the next revision, thanks for mentioning!
Made a new revision with the following changes:
|
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.
Side-note: I would rename the PR
[feature] Automatically open threads for messages in specific channels
CAREER_QUESTIONS_CHANNEL_ID=0987654321 | ||
RESUME_REVIEW_CHANNEL_ID=0987654321 | ||
SHARE_YOUR_CONTENT_CHANNEL_ID=0987654321 |
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.
As discussed on Discord, I believe the auto-thread feature should also be applied to #share-your-content
and #hiring
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.
That's a lot more specific. Renamed the PR to that.
Will add both channels to the code in the next revision.
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.
Because it's fairly dynamic I think it would be better to have a database entry of like a 1 col table where you can add/remove channels by command. Never know if we plan to add or remove channels from this practice
@@ -1,4 +1,5 @@ | |||
#!/bin/sh | |||
. "$(dirname $0)/_/husky.sh" | |||
|
|||
yarn format && yarn lint |
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.
This is a breaking change, as previously yarn format failing would cause pre-commit to fail, and it does not anymore. Probably want set -x
on verification scripts like this.
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.
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 yarn
comment from @crabbycrabby is beyond me, so I can't speak for that.
But the rest looks good to me. (Although my revision is very much on the surface since I am mostly a Java dev.)
I'm submitting an Approval so that my previous "Request changes" doesn't block this PR.
Can you try pull and merge with development branch? |
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.
Overall fine imo. Just needs the mod bypass stuff. Also the dynamic suggestion is more something for a future diff if the time comes to it. Also I merged your last diff in so this may present conflicts weith dev branch.
CAREER_QUESTIONS_CHANNEL_ID=0987654321 | ||
RESUME_REVIEW_CHANNEL_ID=0987654321 | ||
SHARE_YOUR_CONTENT_CHANNEL_ID=0987654321 |
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.
Because it's fairly dynamic I think it would be better to have a database entry of like a 1 col table where you can add/remove channels by command. Never know if we plan to add or remove channels from this practice
if (isMessageReply(message)) { | ||
author.send(defaultStrings.invalidReply(channelName)); | ||
deleteAndReturnMessage(message); | ||
return; | ||
} |
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.
Need bypass for mods.
break; | ||
|
||
// Resume review channel | ||
case getChannelIdForName(CHANNEL_NAMES.RESUME_REVIEW): |
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.
I get the reasoning behind all this, but referring to my more dynamic suggestion I think this is a single breakaway case that can be dealt with like this,
Purpose of pull request
Related Issue: resolves #157
Pull request checklist
NOTE: Please do not merge this before merging into these two PRs
Screenshots
Career Questions:

Resume Review:

Testing instructions
yarn test