[MM-16709] Add helper method for plugins using MessageHasBeenPosted (#12539)

The PR introduces a method in helper interface. The method has common code for filtering to be used across plugins which use MessageHasBeenPosted.
Этот коммит содержится в:
Rajat Varyani
2019-11-18 15:17:32 +05:30
коммит произвёл Ben Schumacher
родитель 9b6a0674f7
Коммит f2fcfa8f9d
6 изменённых файлов: 326 добавлений и 13 удалений

Просмотреть файл

@@ -57,6 +57,18 @@ type Helpers interface {
//
// Minimum server version: 5.6
KVSetWithExpiryJSON(key string, value interface{}, expireInSeconds int64) error
// ShouldProcessMessage returns if the message should be processed by a message hook.
//
// Use this method to avoid processing unnecessary messages in a MessageHasBeenPosted
// or MessageWillBePosted hook, and indeed in some cases avoid an infinite loop between
// two automated bots or plugins.
//
// The behaviour is customizable using the given options, since plugin needs may vary.
// By default, system messages and messages from bots will be skipped.
//
// Minimum server version: 5.2
ShouldProcessMessage(post *model.Post, options ...ShouldProcessMessageOption) (bool, error)
}
// HelpersImpl implements the helpers interface with an API that retrieves data on behalf of the plugin.