talkomatic.py
0.1.2
An easy-to-use Python versatile wrapper for the Talkomatic Bot interface ensuring best practices for making bots, and handling the REST API.
Loading...
Searching...
No Matches
offensive_words.py
Go to the documentation of this file.
1
from
requests
import
get
as
requests_get
2
3
from
dataclasses
import
dataclass
4
5
6
@dataclass
7
class
WordFilter
:
8
"""
9
A class representing the list of blacklisted words and whitelisted words.
10
11
Contains:
12
- offensive_words (list[str]): A list of all the blacklisted strings.
13
- whitelisted_words (list[str]): A list of all the strings allowed overriding the blacklisted strings.
14
"""
15
16
offensive_words: list[str]
17
whitelisted_words: list[str]
18
19
@classmethod
20
def
get
(cls) -> "WordFilter":
21
response = requests_get(
"https://classic.talkomatic.co/js/offensive_words.json"
)
22
if
response.status_code != 200:
raise
RuntimeError(
"Unable to get offensive_words.json."
)
23
data = response.json()
24
25
return
cls(
26
offensive_words = data[
"offensive_words"
],
27
whitelisted_words = data[
"whitelisted_words"
],
28
)
29
30
__all__ = [
"WordFilter"
]
talkomatic.api.v1.offensive_words.WordFilter
Definition
offensive_words.py:7
talkomatic.api.v1.offensive_words.WordFilter.get
"WordFilter" get(cls)
Definition
offensive_words.py:20
talkomatic
api
v1
offensive_words.py
Generated by
1.13.2