Dragory / modmailbot

Modmail Bot is a bot for Discord that makes it easier for users to contact moderators and admins for help.
MIT License
708 stars 705 forks source link

Feature request: multi-server support #63

Closed sporkwitch closed 6 years ago

sporkwitch commented 6 years ago

I've never worked with Node or I'd look into just adding it myself (I'm a Python and C guy), but would it be possible to add support for having the bot monitor / join multiple servers, and include in the log thread which server it originated from (or which of the monitored servers the user in question is in, in the case of a DM)?

While It's obviously lightweight, it feels silly to run separate instances per server, even if using the same token. In terms of settings it seems like it would be simple enough to accept multiple "mainServer" entries, or use an array instead of a string.

Dragory commented 6 years ago

Something like this should definitely be possible. I hadn't implemented proper multi-server support before because it could be ambiguous which server the user was messaging from (if they're in multiple ones), but I suppose it's not an issue if it's directed to the same modteam anyway.

sporkwitch commented 6 years ago

Yup, the only things I see being necessary would be having it list which servers they're in from the monitored list, and allowing multiple mainGuildId for reacting to [at]mentions. Easy enough to add "please say which server this is in regard to" in the auto-reply when they first PM it.

I think those three would cover all that's actually needed, without significant headache or overcomplicated changes. Presumably the bot is only joined to the servers that team is monitoring, so listing mutual would give you the info needed, and if they're on multiple, can just set the autoreply to have them say which it's for (we already have a message pointing people to official support for in-game issues and pointing out we just handle the discord).

That actually does remind me of another useful feature: allowing the person that messaged the bot to close the ticket themselves. Since adding that message we get a fair few "hi"s and if we do reply it's "nevermind, didn't know what it was for"; if they could close their own tickets, it'd save the trouble of closing the ones opened in error.

Dragory commented 6 years ago

For the last paragraph, take a look at the ignoreAccidentalThreads option. It ignores common "accidental" thread-starters such as "hi", "thanks", etc.

That being said, it should be easy enough to add a !close command for the users as well, though probably disabled by default. You could then inform the users about the command in the auto-reply message.

sporkwitch commented 6 years ago

Already had that one enabled to deal with those ones, where it comes up is "some jerk is cheating on [server]" to which the autoreply covers it with "we're only the discord guys, go to [official support url for game] for in-game issues". A lot of times they don't say anything after, would be nice if they could self-close to save us the trouble.

But yep, I think we're definitely on the same page. I'd do it myself and submit a pull request, but i've never worked with node, like i said; port it to python and we can talk :P

Dragory commented 6 years ago

Hey! I added support for this in 2.9.0. Can you see if it works for you? EDIT: I also updated bot mention notifications to include the server name in 2.9.1

Also, thank you for helping out with the issues in this repository! I really appreciate it!

sporkwitch commented 6 years ago

@Dragory When entering mainGuildId as "[id1],[id2]" or "[id1], [id2]", DMs still work, but [at]mentions of the bot result in [WARN] The bot hasn't joined the main guild!; returning to a single id stops the error from occurring, but the bot doesn't create a log entry for the [at]mention. DMs do not indicate shared servers.

Update process was git pull → npm update → npm install → npm start

As far as I can tell, i am on 2.10

re: helping with the other issues, no problem at all.

Dragory commented 6 years ago

The [WARN] would indicate there's only one main guild (otherwise it would say "hasn't joined one or more main guilds"). If you used the format you mentioned in your comment, try ["id1", "id2"] instead (with the quotes)!

sporkwitch commented 6 years ago

So I derped and those brackets are how you specify an array in JSON; entering it that way resolves both the warnings on mentions, and it now shows member servers and local nicknames in the thread creation message.

It is still not logging mentions in member servers, though.

sporkwitch commented 6 years ago

So it looks like it IS responding to [at]mentions, but NOT from people in the inbox server. I assume this is intentional to reduce spam generated by administrative posts telling people to message the bot. Looks like we're all good here. I'll open a separate issue for the self-close suggestion. I also submitted a pull request for a simple change: just renamed the example and added a separate multi-server example (based on the questions I see in the issues, probably a good idea to demonstrate the formatting for the json array; too bad json doesn't support comments, it'd make it cleaner, heh)

Dragory commented 6 years ago

Oh yes, that is true, the bot ignores mentions from people in the inbox server! Also, in regards to JSON comments, I'm planning on switching the config parser to JSON5 which, among other things, supports commas!

sporkwitch commented 6 years ago

Comments, you mean? :P And glorious!

Dragory commented 6 years ago

Oops, yes, comments* 😛

sporkwitch commented 6 years ago

The missing comma was derpy on my part; I just nuked the branch and pull request. I can't think of a way to describe it in the readme that wouldn't just be more confusing; best to just wait until the switch to JSON5 and put a commented-out example in the single example config, as is normal for these kinds of things.

sporkwitch commented 6 years ago

@Dragory can we get it to show which server they're messaging from even if they're only on one? Helps to know which they're coming from if the "customer" is only on one of the monitored servers.

Dragory commented 6 years ago

@sporkwitch Fixed in v2.11.0