MiraWaNeko / DiscordIntegration

Communicate between Minecraft and Discord
https://discordintegration.net
GNU Affero General Public License v3.0
88 stars 42 forks source link

Improve command output and chat readablility #133

Closed Sirse closed 5 years ago

Sirse commented 6 years ago
  1. Wrap command output lines into Discord code block (```).
  2. Remove command executor and command output messages from chat after a configurable time.
Norway174 commented 6 years ago

Also having this problem.

To build on the first point. What if there was a prefix and suffix option we could add to each command, individually.

That way, we can add more info, and / or wrap it in a code block.

Mijago commented 6 years ago

Wrapping stuff into a code block can of course increase readability, but also increases the site of the message on the screen (as there is a passing inside the box and a margin around it).

Worth noting, but nothing serious: Putting something into code brackets must be done carefully, as the message could contain ` by itself, so these must be removed before inserting.

For the 2nd point: Removing command executer after n seconds and removing message output should definitely be two distinct settings. The problem here is that it needs some asynchronous work for each message to be done (keeping track of them and remove them after a given time).

@Norway174 What benefits do you see from prefix and suffixes for command output? Do you see the config to be global or command related?

Norway174 commented 6 years ago

@Mijago Command related. Though maybe a global default option could be added as well. But, in my opinion, that's not too important.

And the benefits are plenty. Not just to make code blocks. You could add other formating too, such as bold, italics, underscore__, and even add your own text. As well as you could even change the type of the codeblock.

As for the message output containing `

If it's in a message from a user, then it may contain it. But it's it's a response from a command, I have never seen that being included in such. Unless the command was specifically written to be outputted into Discord.

At which case, you'd leave the prefix and suffix options empty for that particular command.

However, if you'd rather deal with with. If you're also including the Prefix and Suffix options for messages from players. I'd suggest you also place a \ in front of if that symbol is included in either the prefix or suffix. * will get shown as in Discord, unless it's in a code block. So you'd have to check for that too.

I think having an optional parser for this would be ideal.

Prefix: "", Suffix: "", Parse: true|false

So Parse would then, first check if suffix and prefix contains `, if it does. It'd check the message for that symbol, and convert those to '. And send it. If it does not contain `, then check if prefix or suffix contains , if it does, then it'll convert any in the message to *. And then sends it. And if nothing, then send it as is. This would be same if Parse was set to false.

Hopefully, this makes sense? :P

Mijago commented 6 years ago

It makes perfekt sense. It would also be quite easy to implement it.

But somehow I do not see a great gain of just adding some formatting to commands. For that we could add boolean fields like 'bold', 'italic', etc. But remember, everything we add here pollutes the configuration even more, so we should add as less configuration entries as possible.

But do we really need formatted command result? We could put every command result into a code block, yes, that would be okayish but it will rob the bot the opportunity to format its commands, like the link command in https://github.com/Chikachi/DiscordIntegration/blob/1.12/src/main/java/chikachi/discord/listener/DiscordListener.java . And this is a big downside in my eyes.

I'm not totally against your idea, but we may need to think more about the concept and it's impact to the config / bot.