aminoacid.util.events
This file is for documentation only, it contains all of the possible events the bot can listen on
1"""This file is for documentation only, it contains all of the possible events the bot can listen on 2""" 3from __future__ import annotations 4 5from logging import getLogger 6from typing import TYPE_CHECKING 7 8if TYPE_CHECKING: 9 from ..abc import Message, Notification 10 11logger = getLogger(__name__) 12 13 14async def on_message(message: Message): 15 """This Event will trigger when a new text message is received, it will only be called if the message is not a command 16 17 Parameters 18 ---------- 19 message : Message 20 `Message` object describing the message 21 """ 22 ... 23 24 25async def on_notification(notification: Notification): 26 """This Event will trigger when a websocket message with type 10 is received, that is, a new Notification to send to the app 27 28 Parameters 29 ---------- 30 notification : Notification 31 `Notification` object describing the notification that was sent 32 """ 33 ... 34 35 36async def on_vc_start(notification: Notification): 37 """This Event will trigger when the socket receives a new Event containing notifType 31 38 containing data will look like this: 39 ```json 40 {"payload": { 41 "uid": "00000000-0000-0000-0000-000000000000", 42 "notifType": 31, 43 "aps": { 44 "badge": 1, 45 "alert": 46 "person started Live Mode in Private Chat" 47 }, 48 "community": { 49 "name": "...", 50 "icon": "http://cm1.narvii.com/..." 51 }, 52 "exp": 1660740937, 53 "ndcId": 0, 54 "tid": "00000000-0000-0000-0000-000000000000", 55 "ttype": 0, 56 "id": "00000000-0000-0000-0000-000000000000", 57 "userProfile": { 58 ... 59 } 60 }} 61 ``` 62 63 Parameters 64 ---------- 65 notification : Notification 66 `Notification` object describing the vc start notification that was received 67 """ 68 ... 69 70 71async def on_vc_invite(notification: Notification): 72 """This Event will trigger when the socket receives a new Event containing notifType 29 73 containing data has the same format as `on_vc_start()` 74 75 Parameters 76 ---------- 77 notification : Notification 78 `Notification` object describing the vc invite 79 """ 80 ... 81 82 83async def on_start_typing(event: dict): 84 """Event for when a user starts typing in a given chat 85 `event` structure: 86 ```json 87 { 88 "topic": "ndtopic:x1:users-start-typing-at:00000000-0000-0000-0000-000000000000", 89 "ndcId": 1, 90 "userProfileCount": 1, 91 "userProfileList": [ 92 { 93 ... 94 } 95 ] 96 } 97 ``` 98 99 Parameters 100 ---------- 101 event : dict 102 the event that was sent 103 """ 104 ... 105 106 107async def on_end_typing(event: dict): 108 """Same as `on_start_typing()` only that this is for when the user stops typing 109 110 Parameters 111 ---------- 112 event : dict 113 the event that was sent 114 """ 115 ... 116 117 118async def on_start_recording(event: dict): 119 """Same as `on_start_typing()` only that this is for when the user starts recording a vm 120 121 Parameters 122 ---------- 123 event : dict 124 the event that was sent 125 """ 126 ... 127 128 129async def on_end_recording(event: dict): 130 """Same as `on_start_typing()` only that this is for when the user stops recording a vm 131 132 Parameters 133 ---------- 134 event : dict 135 the event that was sent 136 """ 137 ... 138 139 140async def on_online_members(event: dict): 141 """Event triggered when a user comes online and joins the livelayer 142 143 NOTE: Currently subscribing to the livelayer is very weird and this event doesn't always get triggered, 144 if you want to help with research please DM me on discord (okok#7711)!! 145 146 Structure: 147 ```json 148 { 149 "topic": "ndtopic:x1:online-members", 150 "ndcId": 1, 151 "userProfileCount": 1, 152 "userProfileList": [ 153 { 154 ... 155 } 156 ] 157 } 158 ``` 159 160 Parameters 161 ---------- 162 event : dict 163 the event that was sent 164 """ 165 ... 166 167 168async def empty_cb(*args, **kwargs): 169 """Empty callback for events, this is called when no event callback is defined by the user""" 170 logger.info(f"{args, kwargs}")
15async def on_message(message: Message): 16 """This Event will trigger when a new text message is received, it will only be called if the message is not a command 17 18 Parameters 19 ---------- 20 message : Message 21 `Message` object describing the message 22 """ 23 ...
This Event will trigger when a new text message is received, it will only be called if the message is not a command
Parameters
- message (Message):
Message
object describing the message
26async def on_notification(notification: Notification): 27 """This Event will trigger when a websocket message with type 10 is received, that is, a new Notification to send to the app 28 29 Parameters 30 ---------- 31 notification : Notification 32 `Notification` object describing the notification that was sent 33 """ 34 ...
This Event will trigger when a websocket message with type 10 is received, that is, a new Notification to send to the app
Parameters
- notification (Notification):
Notification
object describing the notification that was sent
37async def on_vc_start(notification: Notification): 38 """This Event will trigger when the socket receives a new Event containing notifType 31 39 containing data will look like this: 40 ```json 41 {"payload": { 42 "uid": "00000000-0000-0000-0000-000000000000", 43 "notifType": 31, 44 "aps": { 45 "badge": 1, 46 "alert": 47 "person started Live Mode in Private Chat" 48 }, 49 "community": { 50 "name": "...", 51 "icon": "http://cm1.narvii.com/..." 52 }, 53 "exp": 1660740937, 54 "ndcId": 0, 55 "tid": "00000000-0000-0000-0000-000000000000", 56 "ttype": 0, 57 "id": "00000000-0000-0000-0000-000000000000", 58 "userProfile": { 59 ... 60 } 61 }} 62 ``` 63 64 Parameters 65 ---------- 66 notification : Notification 67 `Notification` object describing the vc start notification that was received 68 """ 69 ...
This Event will trigger when the socket receives a new Event containing notifType 31 containing data will look like this:
{"payload": {
"uid": "00000000-0000-0000-0000-000000000000",
"notifType": 31,
"aps": {
"badge": 1,
"alert":
"person started Live Mode in Private Chat"
},
"community": {
"name": "...",
"icon": "http://cm1.narvii.com/..."
},
"exp": 1660740937,
"ndcId": 0,
"tid": "00000000-0000-0000-0000-000000000000",
"ttype": 0,
"id": "00000000-0000-0000-0000-000000000000",
"userProfile": {
...
}
}}
Parameters
- notification (Notification):
Notification
object describing the vc start notification that was received
72async def on_vc_invite(notification: Notification): 73 """This Event will trigger when the socket receives a new Event containing notifType 29 74 containing data has the same format as `on_vc_start()` 75 76 Parameters 77 ---------- 78 notification : Notification 79 `Notification` object describing the vc invite 80 """ 81 ...
This Event will trigger when the socket receives a new Event containing notifType 29
containing data has the same format as on_vc_start()
Parameters
- notification (Notification):
Notification
object describing the vc invite
84async def on_start_typing(event: dict): 85 """Event for when a user starts typing in a given chat 86 `event` structure: 87 ```json 88 { 89 "topic": "ndtopic:x1:users-start-typing-at:00000000-0000-0000-0000-000000000000", 90 "ndcId": 1, 91 "userProfileCount": 1, 92 "userProfileList": [ 93 { 94 ... 95 } 96 ] 97 } 98 ``` 99 100 Parameters 101 ---------- 102 event : dict 103 the event that was sent 104 """ 105 ...
Event for when a user starts typing in a given chat
event
structure:
{
"topic": "ndtopic:x1:users-start-typing-at:00000000-0000-0000-0000-000000000000",
"ndcId": 1,
"userProfileCount": 1,
"userProfileList": [
{
...
}
]
}
Parameters
- event (dict): the event that was sent
108async def on_end_typing(event: dict): 109 """Same as `on_start_typing()` only that this is for when the user stops typing 110 111 Parameters 112 ---------- 113 event : dict 114 the event that was sent 115 """ 116 ...
Same as on_start_typing()
only that this is for when the user stops typing
Parameters
- event (dict): the event that was sent
119async def on_start_recording(event: dict): 120 """Same as `on_start_typing()` only that this is for when the user starts recording a vm 121 122 Parameters 123 ---------- 124 event : dict 125 the event that was sent 126 """ 127 ...
Same as on_start_typing()
only that this is for when the user starts recording a vm
Parameters
- event (dict): the event that was sent
130async def on_end_recording(event: dict): 131 """Same as `on_start_typing()` only that this is for when the user stops recording a vm 132 133 Parameters 134 ---------- 135 event : dict 136 the event that was sent 137 """ 138 ...
Same as on_start_typing()
only that this is for when the user stops recording a vm
Parameters
- event (dict): the event that was sent
141async def on_online_members(event: dict): 142 """Event triggered when a user comes online and joins the livelayer 143 144 NOTE: Currently subscribing to the livelayer is very weird and this event doesn't always get triggered, 145 if you want to help with research please DM me on discord (okok#7711)!! 146 147 Structure: 148 ```json 149 { 150 "topic": "ndtopic:x1:online-members", 151 "ndcId": 1, 152 "userProfileCount": 1, 153 "userProfileList": [ 154 { 155 ... 156 } 157 ] 158 } 159 ``` 160 161 Parameters 162 ---------- 163 event : dict 164 the event that was sent 165 """ 166 ...
Event triggered when a user comes online and joins the livelayer
NOTE: Currently subscribing to the livelayer is very weird and this event doesn't always get triggered, if you want to help with research please DM me on discord (okok#7711)!!
Structure:
{
"topic": "ndtopic:x1:online-members",
"ndcId": 1,
"userProfileCount": 1,
"userProfileList": [
{
...
}
]
}
Parameters
- event (dict): the event that was sent
169async def empty_cb(*args, **kwargs): 170 """Empty callback for events, this is called when no event callback is defined by the user""" 171 logger.info(f"{args, kwargs}")
Empty callback for events, this is called when no event callback is defined by the user