[Suggestion] Filter out broadcast messages
LemADEC opened this issue · 14 comments
What you want to be added?
On a public server, it's common to have periodic announcement broadcast in player chat: saving the world, backup running, vote for us, don't cheat, etc. This messages have little to no value in Discord.
In fact, the other discord bridge plugins/mods I've seen in the past just ignore broadcast messages or disable transferring them by default. I've found no similar option in DCIntegration, so please add one :).
I thought ServerChatEvent.getPlayer() was null for broadcast, hence easy to detect, or did I miss something?
The code I use for sending /say messages gets called in the command event, if it is an /say command it sends the arguments as the server or the player who sent it
At least when I tested /say and /me did not send an chat event (1.12).
Tought 1.15 did not change that
the "[server]" prefix don't show in discord, so I could filter out those with your proposed change.
It still feel incomplete in my opinion. I thought ServerChatEvent.getPlayer() was null for broadcast, hence easy to detect, or did I miss something?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
I mean for the broadcast messages. Magi Bridge and discord srv are both discord integrations.
I need to know theese messages are being sent so I can add an way to filter them out
Sponge broadcasts are done through Sponge.getServer().getBroadcastChannel().send(msg);
Console broadcasts are done with a simple command /say <msg>
Chat format and translation can largely be modified, so if you rely on the message content, we'll need a configuration for this.
For the record, Bungee broadcast aren't reported by this mod. Those are done with a simple console command /alert <msg>
command. I guess the proxy directly sends the message to the client, invisibly from the server.
Can you try if this version works? (jar is zipped because you can't upload jar files here, just inzip indo the mods folder)
This is the default configuration entry:
#When an /say command's message starts with this prefix it will not be sent to discord
sayCommandIgnoredPrefix = "§c§o§9§k§r"
So you need to add §c§o§9§k§r
before the broadcast message you want to hide from discord. Since theese are formatting codes and the last one is §r (reset) noone ingame sees them
Actually, I was incorrect, the broadcast from console doing /say <msg>
can't be changed from "[server] ". Could we use a regex expression instead or a list of prefixes?