mojira / mojira-discord-bot

🎮 A Discord bot for linking to and providing information about Mojira tickets
https://discord.gg/rpCyfKV
GNU General Public License v3.0
19 stars 9 forks source link

Modmail #227

Closed chandler05 closed 1 year ago

chandler05 commented 3 years ago

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 commented 3 years ago

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.

dericksonmark commented 3 years ago

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

violine1101 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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!