Skip to content

Commit

Permalink
fixes #18 I hope
Browse files Browse the repository at this point in the history
  • Loading branch information
yGuy committed Apr 16, 2023
1 parent 0e79e4e commit 558f6ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chatgpt-mattermost-bot",
"version": "1.3.2",
"version": "1.3.3",
"private": true,
"scripts": {
"start": "node ./src/botservice.js"
Expand Down
6 changes: 3 additions & 3 deletions src/mm-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ client.setUrl(matterMostURLString)
client.setToken(mattermostToken)

const wsClient = new WebSocketClient();
let matterMostURL = new URL(matterMostURLString);
const wsUrl = `${matterMostURL.protocol === 'https:' ? 'wss' : 'ws'}://${matterMostURL.host}/api/v4/websocket`
const wsUrl = new URL(client.getWebSocketUrl());
wsUrl.protocol = wsUrl.protocol === 'https' ? 'wss' : 'ws'

new Promise((resolve, reject) => {
wsClient.addCloseListener(connectFailCount => reject())
wsClient.addErrorListener(event => { reject(event) })
}).then(() => process.exit(0)).catch(reason => { log.error(reason); process.exit(-1)})

wsClient.initialize(wsUrl, mattermostToken)
wsClient.initialize(wsUrl.toString(), mattermostToken)

module.exports = {
mmClient: client,
Expand Down

0 comments on commit 558f6ca

Please sign in to comment.