Package org.deltava.discord
Class ContentFilter
java.lang.Object
org.deltava.discord.ContentFilter
A Content filter for Discord messages.
- Since:
- 11.0
- Version:
- 11.1
- Author:
- Luke, Danielw
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a word to the content filter.boolean
Removes a word from the content filter.Returns all keywords.Returns all accepted keywords.void
init
(Collection<String> kw, Collection<String> sw) Initializes the content filter.Searches a message for prohibited or accepted keywords.
-
Constructor Details
-
ContentFilter
ContentFilter()
-
-
Method Details
-
init
Initializes the content filter.- Parameters:
kw
- a Collection of keywords to trigger onsw
- a Collection of safe keywords to ignore
-
add
Adds a word to the content filter.- Parameters:
keyword
- the keywordisSafe
- TRUE if an accepted word, otherwise FALSE- Returns:
- TRUE if the word was not present and added, otherwise FALSE
-
delete
Removes a word from the content filter.- Parameters:
keyword
- the keywordisSafe
- TRUE if an accepted word, otherwise FALSE- Returns:
- TRUE if the word was present and removed, otherwise FALSE
-
getKeywords
-
getSafewords
Returns all accepted keywords.- Returns:
- a Collection of accepted keywords
-
search
Searches a message for prohibited or accepted keywords.- Parameters:
msg
- the message- Returns:
- a FilterResults bean
-