-
Notifications
You must be signed in to change notification settings - Fork 138
/
plugin.proto
66 lines (51 loc) · 1.19 KB
/
plugin.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
syntax = "proto3";
option go_package = "devzat/plugin";
package plugin;
service Plugin {
// Events are implemented through a stream that is held open
rpc RegisterListener(stream ListenerClientData) returns (stream Event);
rpc RegisterCmd(CmdDef) returns (stream CmdInvocation);
// Commands a plugin can call
rpc SendMessage(Message) returns (MessageRes);
}
/* RegisterListener */
message Event {
string room = 1;
string from = 2;
string msg = 3;
}
message ListenerClientData {
oneof data {
Listener listener = 1;
MiddlewareResponse response = 2;
}
}
message Listener {
optional bool middleware = 1;
optional bool once = 2;
// Regex to match against to determine if this listener should be called
// Does not include slashes or flags
optional string regex = 3;
}
message MiddlewareResponse {
optional string msg = 1;
}
/* RegisterCmd */
message CmdDef {
string name = 1;
string argsInfo = 2;
string info = 3;
}
message CmdInvocation {
string room = 1;
string from = 2;
string args = 3;
}
/* SendMessage */
message Message {
string room = 1;
optional string from = 2;
string msg = 3;
optional string ephemeral_to = 4;
}
message MessageRes {}