WebSocket#
BotiCord Websocket#
- class BotiCordWebsocket(token: str)[source]#
Bases:
object
Represents a client that can be used to interact with the BotiCord by websocket connection.
- @listener[source]#
Decorator to set the listener.
Warning
Callback functions must be a coroutine. If they aren’t, then you might get unexpected errors. In order to turn a function into a coroutine they must be
async def
functions.For example:
@websocket.listener() async def comment_removed(data): pass
- register_listener(notification_type: str, callback: Any)[source]#
Method to set the listener.
- Parameters:
notify_type (
str
) – Type of notification (Check reference page)callback (
function
) – Coroutine Callback Function
Warning
Callback functions must be a coroutine. If they aren’t, then you might get unexpected errors. In order to turn a function into a coroutine they must be
async def
functions.
Notification types#
- up_added(data)#
Called when up is added.
- comment_added(data)#
Called when comment is added.
- comment_edited(data)#
Called when comment is edited.
- comment_removed(data)#
Called when comment is deleted.