Source code for pyrcareworld.attributes.custom_attr
import pyrcareworld.attributes as attr
[docs]
class CustomAttr(attr.BaseAttr):
"""
This is an example of a custom attribute class, without actual functions.
The data stored in self.data is a dictionary containing the following keys:
- 'custom_message': a custom message.
"""
[docs]
def parse_message(self, data: dict):
"""
Parse messages. This function is called by an internal function.
data['custom_message']: A custom message.
"""
super().parse_message(data)
# An example of a new API
[docs]
def CustomMessage(self, message: str):
"""
Send a custom message.
:param message: Str, the custom message to be sent.
"""
self._send_data("CustomMessage", message)