Skip to content

Message API

Red_wolf2467 edited this page Nov 20, 2024 · 2 revisions

About

The message API is there to analyze messages or text for badwords. As soon as the API receives a request on this endpoint, the server runs through the text using a levensthein to recognize badwords and words that are similar to them.

How to use

To make an API request, you must use this endpoint: /chatfilter
A json must be attached there that looks like this:

{
    "key": "Your API key",
    "message": "TEXT"
}

You will then receive a JSON in response. If the server finds NONE questionable words, an empty json is returned: {}
If a relevant word is recognized, the following JSON is returned:

{
    "input_word": "STR",
    "matched_badword": "STR",
    "distance": 0,
}

input_word = The word that triggered the chat filter
matched_badword = The word in the badword list that matches the input word.
distance = The distance between the word entered and the word in the list. (0 = direct match) (INT)#

Sample

import requests

json = {"key": "Your API key", "message": "HI, my name is Red. This is a test."}
response = requests.get("http://solyra.avocloud.net:1652/chatfilter", json=json)

data = response.json()
print(data)

Response:

{}
Clone this wiki locally