MCPcopy Create free account
hub / github.com/Botloader/botloader / wsOnMessage

Method wsOnMessage

botloader-vscode/src/ws.ts:80–101  ·  view source on GitHub ↗
(msg: MessageEvent)

Source from the content-addressed store, hash-verified

78 }
79
80 wsOnMessage(msg: MessageEvent) {
81 let decoded: WsEvent = JSON.parse(msg.data.toString());
82 switch (decoded.t) {
83 case "AuthSuccess":
84 this.auth = true;
85 this.logToOutput("successfully authorized", "Client");
86
87 for (let g of this.subQueue) {
88 this.subscribeGuild(g);
89 }
90 this.subQueue = [];
91
92 break;
93 case "ScriptLogMessage":
94 this.handleScriptLogMessage(decoded);
95 break;
96 case "SubscriptionsUpdated":
97 this.logToOutput("subscriptions updated successfully: " + decoded.d, "Client");
98 this.activeSubs = decoded.d;
99 break;
100 }
101 }
102
103 wsOnClose(ev: CloseEvent) {
104 this.logToOutput(`ws closed ${ev.reason}, reconnecting in 5 sec...`, "Client");

Callers

nothing calls this directly

Calls 4

logToOutputMethod · 0.95
subscribeGuildMethod · 0.95
toStringMethod · 0.80

Tested by

no test coverage detected