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

Modmail #227

Merged
merged 19 commits into from
Jun 25, 2023
Merged

Modmail #227

merged 19 commits into from
Jun 25, 2023

Conversation

chandler05
Copy link
Member

@chandler05 chandler05 commented Jul 11, 2021

Purpose

Resolve #226 (probably worth discussing before merging, but it has already been discussed and the general consensus is so far in favor of this)
Add the database functionality!

Approach

DMs to Mojira Bot are forwarded to an internal channel and put into a thread.
/modmailban to ban a user from using the modmail system.
/modmailunban to unban a user from using the modmail system.
Reply in a modmail message thread to send a reply back to the user.
Threads will be archived after 24h of inactivity, after which a new thread will be created for subsequent messages

Future work

New channel needed for modmail, combine with #209's message event handler.

Add direct reply functionality when discord.js v13 is added.

@chandler05
Copy link
Member Author

Looks like the package-lock.json file got a bunch added to it when I ran npm install. I'm not sure which of it should be kept or removed, if any.

}
} else if ( banStatus !== undefined ) {
try {
await origin.channel.send( 'We\'re sorry, but you have been banned from sending any further modmail messages.' );
Copy link
Member Author

@chandler05 chandler05 Jul 14, 2021

Choose a reason for hiding this comment

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

Since we haven't taken DM rate limiting into account (not too big of a deal imo), this could be removed and left with the reaction to the message instead.

@dericksonmark
Copy link
Member

Could this also forward screenshots/images attached to the message? A user may attach one to a modmail message.

@chandler05 chandler05 marked this pull request as draft August 15, 2022 13:06
@violine1101
Copy link
Member

I haven't fully looked at this PR but it's certainly something I'm excited about.

With the new Discord features now available, I think the best solution would be to have a thread for each user who messages MojiraBot via DMs in the modmail channel. That's probably not too easy to implement though and as such out of scope for this PR, so let's just land this first and then we can still expand on it later if necessary. (tbh I don't think the volume of modmail would be too large anyway)

@chandler05
Copy link
Member Author

chandler05 commented Aug 15, 2022

I'll need to refactor parts of the PR to match discord's and the bot's new changes, so I can add threads while I do that :)

@chandler05
Copy link
Member Author

I've switched the system to use threads, and it will now forward attachments on messages as well. Threads are archived after 24 hours, so a new thread will be created for new messages from that user afterwards, just to make sure modmails are seen. This one is now ready for review!

@chandler05 chandler05 marked this pull request as ready for review August 15, 2022 22:16
Copy link
Member

@violine1101 violine1101 left a comment

Choose a reason for hiding this comment

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

I'd like to apologize for taking this long to look at the PR. I don't have a good reason for that, I just procrastinated on it too much.

Thank you for adding this - it's very much needed. No concerns about the code itself.

I had concerns over the DM channel no longer being usable as a personal place to try out commands, but I noticed that with the slash commands this is not really possible anymore anyway.

I do not like MojiraBot having too many distinct feature sets: It is responsible for ticket embeds, feeds, requests, and now also modmail. Optimally I'd like to separate these four responsibilities into four separate bots for easier maintenance. This would also allow us to finally make this bot publicly accessible, in particular the parts of it responsible for ticket embeds (and maybe also feeds). But this is way out of scope for this PR.

With that being said, let's finally merge this!

@violine1101 violine1101 merged commit 4addb81 into master Jun 25, 2023
@violine1101 violine1101 deleted the modmail branch June 25, 2023 12:14
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.

Forward direct messages sent to the bot to an internal channel
3 participants