Skip to content

Commit 48e0465

Browse files
Techbot121Meta Construct
authored andcommitted
move hooks up to class properties
1 parent 23ebe36 commit 48e0465

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

app/services/gamebridge/GameBridge.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ export default class GameBridge extends Service {
2121
webApp: WebApp;
2222
ws: WebSocketServer;
2323
servers: GameServer[] = [];
24-
discordChatWH: Discord.WebhookClient;
25-
discordErrorWH: Discord.WebhookClient;
26-
discordPacErrorWH: Discord.WebhookClient;
24+
discordChatWH = new Discord.WebhookClient({
25+
url: config.chatWebhookUrl,
26+
});
27+
discordErrorWH = new Discord.WebhookClient({
28+
url: config.errorWebhookUrl,
29+
});
30+
discordPacErrorWH = new Discord.WebhookClient({
31+
url: config.pacErrorWebhookUrl,
32+
});
2733
ready: boolean = false;
2834

2935
constructor(container: Container) {
@@ -33,19 +39,11 @@ export default class GameBridge extends Service {
3339

3440
private async init() {
3541
this.webApp = await this.container.getService("WebApp");
42+
3643
this.ws = new WebSocketServer({
3744
httpServer: this.webApp.http,
3845
autoAcceptConnections: false,
3946
});
40-
this.discordChatWH = new Discord.WebhookClient({
41-
url: config.chatWebhookUrl,
42-
});
43-
this.discordErrorWH = new Discord.WebhookClient({
44-
url: config.errorWebhookUrl,
45-
});
46-
this.discordPacErrorWH = new Discord.WebhookClient({
47-
url: config.pacErrorWebhookUrl,
48-
});
4947

5048
this.ws.on("request", req => {
5149
this.handleConnection(req);

0 commit comments

Comments
 (0)