kordlib / kordx.commands

Kotlin Command library for Kord and other APIs
MIT License
20 stars 3 forks source link

Feature Improvements #2

Open KodingDev opened 4 years ago

KodingDev commented 4 years ago

Suggestions

BartArys commented 4 years ago

Could you elaborate some of these points a bit more? I'll go over some of these myself with the immediate remarks I have, but please expand on all of them.

Support for message edits when processing commands

This is a tricky one to implement, MessageUpdateEvents don't contain the 'full' message object, only the changed values. We can't guarantee these to be present in cache either.

The way I see it there's two routes to implement this:

None of those are particularly appealing to me. Perhaps you could clarify the need of this feature, and see if we can't find an alternative approach.

Allow embeds to have defaults using plugs (Possibly?)

This has been asked a few times already in Kord itself. I'm of the opinion myself that defaults can be perfectly simulated by users via extension functions. Users can implement their own, for example, respondSuccess and respondError extension functions without losing clarity or brevity. You're free to debate this point further but I'm almost certainly convinced that extension functions created and maintained by users are a far better solution to the problem of duplicated code.

DSL for building markdown in descriptions + optional escaping

A good feature to request IMO. Something I personally wanted to add to Kord in some way or form myself. A working version wouldn't be hard to implement per se. The scope of supported markdown is up for debate, it is probably most reasonable to support only Discord's subset of Markdown.

Regarding the optional escaping. I had though this was mostly solved with the allowedMentions DSL in the MessageCreateBuilder.

KodingDev commented 4 years ago

Support for message edits when processing commands

Main use for this which I've found quite helpful in other bots is for correcting small errors whilst processing commands. For example, in a math command with a complex equation, if you've mistyped a single number then editing the message is far more appealing to the user than copy pasting the whole thing. It could possibly be done through manually listening for the message event and then calling the command handler with the message object rather than the event, however I haven't looked into it.

Allow embeds to have defaults using plugs (Possibly?)

Yep that makes a lot of sense. I'll remoe that from the list.

DSL for building markdown in descriptions + optional escaping

Yep, only Discord's subset of markdown should be needed. Also with the escaping I think that'd be a good idea to include, but as false by default in the methods. Main reason is that, for example, certain names with underscores don't italicise a join message for example. Up to you of course.

Animeshz commented 4 years ago

Support for message edits when processing commands

I recently stumbled across this and needed this for some personal projects, I was working on this since yesterday.

Almost done, but currently the caching for data between invocation of edited command and last ran command (as an example to track the message we've sent on the first/prior run) is not properly handled due to Type inference failed by lambda return type. So, I'd PR for this feature as soon as this lib synchronize with Kord 0.7.x and the mentioned issue is fixed.