Skip to content
This repository has been archived by the owner on Apr 16, 2023. It is now read-only.

Feature Improvements #2

Open
1 of 4 tasks
KodingDev opened this issue Jun 19, 2020 · 3 comments
Open
1 of 4 tasks

Feature Improvements #2

KodingDev opened this issue Jun 19, 2020 · 3 comments

Comments

@KodingDev
Copy link

KodingDev commented Jun 19, 2020

Suggestions

  • Command error handling for those thrown in execution
  • Support for message edits when processing commands
  • Possible DSL for error handlers
  • DSL for building markdown in descriptions + optional escaping
@BartArys
Copy link
Contributor

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:

  • Either we cripple the current CommandEvent and provide a common interface. Effectively reducing a command to a channel behavior and text.
  • Or we provide a separate DSL for edited messages.

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
Copy link
Author

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
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants