sofar.go
· 2.1 KiB · Go
Sin formato
// Event handler for the websocket
type EventHandlers struct {
// Not an actual revolt event, this is a sink that allows you to provide a function for raw event handling
RawSinkFunc func(w *GatewayClient, data []byte, typ string)
// An error occurred which meant you couldn't authenticate.
//
// <Note that grevolt handles these for you in general, but you can provide additional logic here>
Error func(w *GatewayClient, e *events.Error)
// The server has authenticated your connection and you will shortly start receiving data.
Authenticated func(w *GatewayClient, e *events.Authenticated)
// Several events have been sent, process each item of v as its own event.
//
// <Note that grevolt handles these for you in general, but you can provide additional logic here>
Bulk func(w *GatewayClient, e *events.Bulk)
// Ping response from the server.
//
// <Note that grevolt handles these for you in general, but you can provide additional logic here>
Pong func(w *GatewayClient, e *events.Pong)
// Data for use by client, data structures match the API specification
Ready func(w *GatewayClient, e *events.Ready)
// Message received, the event object has the same schema as the Message object in the API with the addition of an event type.
Message func(w *GatewayClient, e *events.Message)
// Message edited or otherwise updated.
MessageUpdate func(w *GatewayClient, e *events.MessageUpdate)
// Message has data being appended to it.
MessageAppend func(w *GatewayClient, e *events.MessageAppend)
// Message has been deleted.
MessageDelete func(w *GatewayClient, e *events.MessageDelete)
// A reaction has been added to a message.
MessageReact func(w *GatewayClient, e *events.MessageReact)
// A reaction has been removed from a message.
MessageUnreact func(w *GatewayClient, e *events.MessageUnreact)
// A certain reaction has been removed from the message.
//
// <the difference between this and MessageUnreact is that
// this event is sent when a user with manage messages removes
// a reaction while MessageUnreact is sent when a user removes
// their own reaction>
MessageRemoveReaction func(w *GatewayClient, e *events.MessageRemoveReaction)
}
1 | // Event handler for the websocket |
2 | type EventHandlers struct { |
3 | // Not an actual revolt event, this is a sink that allows you to provide a function for raw event handling |
4 | RawSinkFunc func(w *GatewayClient, data []byte, typ string) |
5 | |
6 | // An error occurred which meant you couldn't authenticate. |
7 | // |
8 | // <Note that grevolt handles these for you in general, but you can provide additional logic here> |
9 | Error func(w *GatewayClient, e *events.Error) |
10 | |
11 | // The server has authenticated your connection and you will shortly start receiving data. |
12 | Authenticated func(w *GatewayClient, e *events.Authenticated) |
13 | |
14 | // Several events have been sent, process each item of v as its own event. |
15 | // |
16 | // <Note that grevolt handles these for you in general, but you can provide additional logic here> |
17 | Bulk func(w *GatewayClient, e *events.Bulk) |
18 | |
19 | // Ping response from the server. |
20 | // |
21 | // <Note that grevolt handles these for you in general, but you can provide additional logic here> |
22 | Pong func(w *GatewayClient, e *events.Pong) |
23 | |
24 | // Data for use by client, data structures match the API specification |
25 | Ready func(w *GatewayClient, e *events.Ready) |
26 | |
27 | // Message received, the event object has the same schema as the Message object in the API with the addition of an event type. |
28 | Message func(w *GatewayClient, e *events.Message) |
29 | |
30 | // Message edited or otherwise updated. |
31 | MessageUpdate func(w *GatewayClient, e *events.MessageUpdate) |
32 | |
33 | // Message has data being appended to it. |
34 | MessageAppend func(w *GatewayClient, e *events.MessageAppend) |
35 | |
36 | // Message has been deleted. |
37 | MessageDelete func(w *GatewayClient, e *events.MessageDelete) |
38 | |
39 | // A reaction has been added to a message. |
40 | MessageReact func(w *GatewayClient, e *events.MessageReact) |
41 | |
42 | // A reaction has been removed from a message. |
43 | MessageUnreact func(w *GatewayClient, e *events.MessageUnreact) |
44 | |
45 | // A certain reaction has been removed from the message. |
46 | // |
47 | // <the difference between this and MessageUnreact is that |
48 | // this event is sent when a user with manage messages removes |
49 | // a reaction while MessageUnreact is sent when a user removes |
50 | // their own reaction> |
51 | MessageRemoveReaction func(w *GatewayClient, e *events.MessageRemoveReaction) |
52 | } |
53 |