-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add Mention Config. Implements #14, #15 and #20 #21
Conversation
Some stuff to think about: Currently, the field types are pretty hardcoded. With that it would be also cool to allow for conditions like The same could be done for the currently hardcoded other parts of the Discord-Embed. The grouped embed is currently not configurable at all, though that isn't too much of a priority as there isn't that much potentially customizable so far anyways. And finally an inconsistency that could be worked out before merge: As stated in the first message, the bot now deletes any message where everything in the message is either an whitespace or something that resolves entirely as mention.
A way to fix this would be to let all mention types try to match the entire message and then later prune duplicated tickets. This might also make it possible to add max_ungrouped_mentions per mention type. |
Woah, this is amazing! Thank you so much for this! This went much further than I first imagined. I thought of renaming This also means that I need to rethink how I want to manage the whole config part. Server moderators should be able to choose which embeds they want to use and which prefixes should (or should not) trigger embeds by a command. With this custom config system being a bit more complex than I anticipated, this might be a bit more difficult to realize. As it is quite a large change, I'd take a more detailed look at it after we've merged #19 into master. |
Yeah, I also thought about how to make it runtime-configurable. Especially if I end up adding those things I theorized about, it's not gonna be easy. |
…into feature/mention-config
…into feature/mention-config
* `default_embed` now defines the embed type that should be used in case none is given * The default embed is also used for `BugCommand` * Added `MentionUtil` * Moved RegEx- presets from `MentionCommand` to `MentionUtil` * Has functionality for getting the correct mentions. * Has functionality for sending mentions. * `MentionRegistry` has been removed. Functionality for getting the correct Mention instance has been moved to `MentionUtil` * `SingleMention` is now an abstract class, currently only extended by `CustomMention` * The maximum description length that can be set for embed types is now 2048 to match Discord's restrictions (see https://discordapp.com/developers/docs/resources/channel#embed-limits)
…e mention matching and message deletion more consistent, fixed multiple mentions of differnt types producing duplicate embeds
…that matched instead of only ticket ids
So, all the problems I still saw with this are fixed now. The only thing I talked about in here which is not implemented is less hardcoded field types by allowing for combining multiple types and having conditions for different parts of a field or an entire field. But I think the pr is big enough already and we can always make it more customizable later. |
b8fffcc
to
879b933
Compare
…into feature/mention-config
879b933
to
56b52ec
Compare
Okay, I took a more detailed look at this change and there are a few things I want to say about this. First of all, it makes everything configurable on a very atomic level. I'm not really sure if this is desirable. The definition for the different embed types need to be configured in a very rigid way in the For instance, is it necessary to be able to give fields different labels? Usually when you want a field, it will already have a name that we know of. Also, as you already mentioned, it's impossible to alter the label depending on the field's context due to the embed type config's rigid format. Another issue where the JSON config is more hindering than helping is the fact that conditions cannot be easily implemented, like you already mentioned in your first comment. Additionally, there will be the problem of making this work with guild- and channel-based configuration. Of course we can just say that every server has the same pool of embed types that is defined in the Instead, it might make sense to just have the embed types in different classes that can have conditions, dynamic labels, and that we can easily change and add. If they were all hidden behind the Now to the mention types: How should the bot act if two different mention types are triggered at once? Should it post both (this is what it currently does)? Or the first one in the list? This is not really intuitive. I propose to simplify this heavily by just having a map of mention type → embed type that might look like this:
The keyword would just be a global option that prevents all types of embeds. Usually that would only be used for "none" type mentions, I don't think it would be used much for others. Thus I think just a simple option like This PR adresses multiple issues at once, making it quite a mammoth change in total. I'd have liked to merge the other two changes, but since they're combined in this PR, we won't be able to do that. Lastly, I really appreciate the effort you put into this and I feel really bad for writing this all up 😕 and I hope you can understand where I'm coming from. |
I could use that as default value, but I do think it could be needed for some cases, especially when using stuff like
I could still do that, I had some ideas for that, but I didn't want to expand the scope of this pr even further for now, without some input at the very least ;)
So, that's something we should talk about more. Now, the way you talk about it now, it seems like you intend to use some other kind of storage. Of course I intended for guilds to be able to configure embeds, that's why I implemented it that way.
No, it currently uses the first one it can use. To me this behaviour is very intuitive, why would you want to trigger 2 different embeds on the same message (especially considering ideas as presented in #13). There is some complexity however added by allowing to define The way I implemented it, first a set of mention types that apply for a certain ticked ID are stored in a map from ID to Set.
Well, there might be cases where you want to trigger a more detailed embed, for example when using a !verbose keyword. That was my whole idea behind that, being able to precisely configure when which embed should trigger. If it's more desired to keep it simple, we could think about whether that's actually needed.
Well, It made sense to consider things like #20 while redesigning how mentions are handled.
I kind of didn't expect you to merge it yesterday anyways, just because it's a big one, it doesn't come to me as a surprise some things needed further discussion, in fact I am pretty happy that someone took a look and gave me some input ;) |
|
I'm closing this PR. It's become too old to be mergeable. I'm sorry, it's my fault that this happened; when I initially wrote the bot, I didn't expect to not be the only one working on it, and thus kept the first issues kinda vague and didn't think of sharing what my vision and plans were. We can still take ideas and code from this PR when we finally add support for custom embeds, which I'd still like to do after we've set up proper support for having the bot on more than one server. |
This pull request makes mentions fully configurable. This includes embeds themselves.
BugCommand
can be configured.MC-1 MC-2 MC-3
all trigger a mention, and the message does not contain anything else, the message will be deleted.(mention1, mention2, ...), (mention1, mention2, ...), ...
(MC-1, MC-2), (https://bugs.mojang.com/browse/MC-3), (!MC-4, !MC-5)
required_keyword
, if available.!keyword(mention1, ...)
Mention types allow for these configurations:
Embeds can be configured like this:
The verbose embed is missing the creator. In the current implementation, the creator is only shown when different from the reporter.
Currently, it is not possible to define conditions.