kangarko / ChatControl-Red

Issue tracker and documentation for the next generation ChatControl Red, the most advanced chat management plugin.
49 stars 22 forks source link

Add predefined format from formats folder to be able to use in a lot of Channels.List formattings #2804

Open TheJoshue opened 3 months ago

TheJoshue commented 3 months ago

Summary

So when we are defining a channel in Channels.List, we have

Channels:
<...>
  List:
    standard:
      Format: chat

There are a lot more options such as Format_Console, Format_Discord_Webhook_Name, Format_Discord, Format_Spy, etc...

For the ones i mentioned, maybe for some it is possible, but for discord format and webhook it does not work - to be able to enter "chat" where we are pulling formattings from formats/chat.yml

of course we can have separate discord_webhook_name.yml and format_discord.yml or whatever we like, but i think this would be very useful and not hard to implement

and options like hovering text and clickable will not work / be ignored if used for format which does not support it, i think there will be no problems with that at all

Thank you in advance if you consider this, much appreciated

PS. only reason i think this is needed is because formats give us PARTS and parts gives us UNLIMITED CONDITIONS to be used, and that is powerful thing, this cannot be done directly in Channels.Lists... and even if it is possible, it would be such a mess if we can add parts there - that is why we have formats and that should be utilized for as much format options in Channels.Lists as possible!

TheJoshue commented 3 months ago

The thing that is very messed up as of now is Format_Discord

you can use format from formats folder here, so we can use for example Format_Discord: chat-discord where formats/chat-discord.yml is used, but this only works when message is sent From Discord To Minecraft, when you try to send message from minecraft to discord, this is how it shows on discord: image

So please, change Format_Discord to 2 separate formats:

and for sure allow usage of predefined formats from formats folder for Format_From_Discord, for the Format_From_Minecraft this can also be allowed (why not?), admins just need more caution about things that will not work as they are present in minecraft and not on discord (such as text hovering/clicking...)

TheJoshue commented 3 months ago

I just want to show how easy it would be if Format_Discord would support linking to formats from formats folder, no need for separating into 2 formats as i mentioned above:

settings.yml

Channels:
  List:
    standard:
      Format: chat
      Format_Console: '[{luckperms_primary_group_name}] {player}&r &8>&r {luckperms_meta_chat_color}{chat_color}{chat_decoration}{message}&r'
      Discord_Channel_Id: 1234567891011121314
      Format_Discord: chat-discord

for the formats/chat.yml we have our regular chat ingame based...

formats/chat-discord.yml:

New_Line_Per_Part: false

Parts:
  From_Minecraft_To_Discord-part_1:
    Sender_Condition: '{sender_is_player}'
    Message: '{player_name} > {message}'
  From_Discord_To_Minecraft-part_1:
    Sender_Condition: '{sender_is_discord}'
    Message: '&8[&9Discord&8] &b{discordsrv_user_nickname} &8» &e{message}'

And that is everything handled, I really don't know why it's not already working like this...

TheIntolerant commented 3 months ago

Just adding to what has already been said

It should be noted that multiple people on Discord have found the change to "Discord_Format" confusing and limiting. As seen here: image

The formatting syntax is different on Discord compared to Minecraft. For instance **{player}** on discord requires &l{player} on minecraft therefore limiting the way in which people

TheIntolerant commented 3 months ago

If the reason it was changed again was that people not understanding how to format discord messages via the standard "Format" section. Would it not be best to add

Format_Minecraft_To_Discord:
Format_Discord_To_Minecraft:

instead?

kangarko commented 3 months ago

Agreed. I'm gonna rename it and document it in the wiki too so it's 100% clear, my bad. Leaving open when I get to this.

TheJoshue commented 3 months ago

Agreed. I'm gonna rename it and document it in the wiki too so it's 100% clear, my bad. Leaving open when I get to this.

Veyr nice to hear, please man, just make sure that both of the formats:

Let admins simply handle this, we can use conditions for some things such as player_is_discord still and also PAPI (especially if player has linked discordSRV, i hope that CHCRED can then apply papi placeholders which do not require player to be online to be parsed)

Thank you so much in advance!

kangarko commented 3 months ago

Yep, I will add the two formats and check for variables if we find a linked offlineplayer account!

TheJoshue commented 3 months ago

Yep, I will add the two formats and check for variables if we find a linked offlineplayer account!

Very nice Just at least for Format_Discord_To_Minecraft add support for formatting from formats folder, but both discord formats supporting that would be even better

kangarko commented 2 months ago

Both options will support formats or direct input

TheJoshue commented 2 months ago

@kangarko can you maybe implement option to delete message if it is flagged by rules or something, because it detects properly, we then just need to use discordSRV discord bot to delete the message that is flagged? before that check if it's discord message ofc if needed check it out: image

So the message thas bot has sent was in CHCPRO previously found in handlers.yml file, i bet this message is in CHCRED somewhere but hardcoded(?) because i can't find it in any file, which should also be configurable?

This message is also ingame of course image

EDIT: Found it, sorry; it's at ChatControlRed/rules/groups.rs Sorry for making digressions

kangarko commented 2 months ago

Unfortunately I dont have time for this.

TheJoshue commented 2 months ago

Unfortunately I dont have time for this.

no worries man, at least formats! that's all we need:)

kangarko commented 2 months ago

Thank you and thank you for your understanding! <3

noaskers commented 2 months ago

Okay @TheIntolerant How can I achieve it right now then or do I need to wait on this update?

TheIntolerant commented 2 months ago

Okay @TheIntolerant How can I achieve it right now then or do I need to wait on this update?

I believe it's done via the discord-format option directly in settings

noaskers commented 2 months ago

image

I don't want to change the way it looks in discord aswell I just want to change the way it looks when a message comes from discord.

TheIntolerant commented 2 months ago

After version 10.27.0 the way discord formatting worked was changed as shown here image

Which is why this suggestion was made, as it has been a frequent occurrence where people were confused as to how they could format discord chat both in-game and on the discord server.

As addressed in #2698 The manner in which discord messages are formatted has proven to be more confusing than anything else as this is a common issue but unfortunately attempts at rectifying issues hasn't been effective.

Which is why I truly believe this specific suggestion is the best way to solve these issues going forward.

kangarko commented 2 months ago

Agreed with @TheIntolerant, we will have two distinct keys to fully customize mc>discord and discord>mc format in the next version. I will also ditch DiscordSRV to solve some oddities and improve proxy compatibility and performance, we will use the native JDA library instead.

kangarko commented 2 months ago

ETA 1 week

kangarko commented 1 month ago

Had to postpone this, new ETA is 1-2 weeks

TheJoshue commented 1 month ago

@kangarko not to hurry you up, just to ask what's up image

kangarko commented 1 month ago

Please follow our discord announcements :)

https://discord.com/channels/360404674219737100/375364750588248064/1295383511963926538

kangarko commented 2 weeks ago

Unfortunately I do not have the capacity to re-implement 90% of discordsrv features and all the placeholder and dynamic webhook creation and safety systems, so I dropped this. Just keep using discordsrv.

We will implement this ticket into v11 tho.

BearLeonLight commented 2 weeks ago

Unfortunately I do not have the capacity to re-implement 90% of discordsrv features and all the placeholder and dynamic webhook creation and safety systems, so I dropped this. Just keep using discordsrv.

We will implement this ticket into v11 tho.

Can Discord(MC_to_DC) be considered a Receiver? The only problem I have encountered so far is that I can no longer hide a certain line of content in the Format when using the Format_Discord_Webhook_Name and Webhook functions.

For example, if I want to hide the player's ID in the DC to MC message and display the DC name in the DC to MC message, I can only achieve the second point. The first point cannot be achieved. In earlier versions, I could achieve this.

kangarko commented 2 weeks ago

Yes. I plan on adding two separate formats and you can use the javascript condition to show or hide them. I will rework the placeholders a bit so that it should be possible now.

BearLeonLight commented 1 week ago

Unfortunately I do not have the capacity to re-implement 90% of discordsrv features and all the placeholder and dynamic webhook creation and safety systems, so I dropped this. Just keep using discordsrv. We will implement this ticket into v11 tho.

Can Discord(MC_to_DC) be considered a Receiver? The only problem I have encountered so far is that I can no longer hide a certain line of content in the Format when using the Format_Discord_Webhook_Name and Webhook functions.

For example, if I want to hide the player's ID in the DC to MC message and display the DC name in the DC to MC message, I can only achieve the second point. The first point cannot be achieved. In earlier versions, I could achieve this.

I use: Channels.Format_Discord: '{message}' Not used: Channels.List.Format_Discord: '{message}' The effect I want can be achieved. The two logical processing methods seem to be different. The current Channels.Format_Discord can perfectly achieve my needs~~.

BearLeonLight commented 1 week ago

Using the logic before the change can achieve what I need. I hope this logic will not be changed until the remastered version of CHC is released. Channels.Format_Discord: '{message}

kangarko commented 1 week ago

Yeah but the split will be more customizable for other customers too. Nope, the old chatcontrol will stay the same.

kangarko commented 1 week ago

In the new one you can just use the same value for both Format_Mc_To_Discord and Format_Discord_To_Mc or whatever the keys will be named