RocketChat / Rocket.Chat.Apps-engine

The Rocket.Chat Apps engine and definitions.

Home Page:https://rocketchat.github.io/Rocket.Chat.Apps-engine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add IModify to executePreMessageSentPrevent

cuonghuunguyen opened this issue · comments

In case we want to process the message but don't want to add the message to the database. E.g. Process some special command format, filter bad words and send warnings, etc. The method executePreMessageSentPrevent should have the same accessors as executePostMessageSent.
I think we should also add the IModify accessor to extends the usage of the apps engine

I disagree. Mutating something in this listener should not happen as that goes against the convention. The Prevent suffix was solely intended for preventing a message from being sent and not modifying anything else based upon preventing a message (and the UI doesn't react well to preventing, so this needs some attention). This logic sounds like it should go into the other preMessageSent ones and not prevent.

But that's simply my opinion. :)

I do get your point, it makes sense. But I will keep my proposal :D, there will be many things we could do with this change. E.g: Kick a member out of the room if he says offensive words.

Re-open since there would be huge number of usecases it can support