Skip to content

Commit

Permalink
2.4.1
Browse files Browse the repository at this point in the history
discord rich presence allows for inviting players to mm lobby
(steam profile must be public)
  • Loading branch information
CorySanin committed Jul 13, 2019
1 parent b2738b0 commit 721203c
Show file tree
Hide file tree
Showing 5 changed files with 384 additions and 14 deletions.
12 changes: 12 additions & 0 deletions main.js
Expand Up @@ -6,7 +6,9 @@ const BrowserWindow = electron.BrowserWindow // Module to create native browser
const path = require('path')
const url = require('url')
const os = require('os')
const request = require('request')
const i18n = require('./locales/index.js')
const { JSDOM } = require("jsdom")

const menu = new electron.Menu()
const launchcsgo = 'steam://rungameid/730'
Expand Down Expand Up @@ -156,3 +158,13 @@ ipc.on('csgoicon', function (event, exepath){
])
}
})

ipc.on('inviteUrl', function (event, steamid){
request('https://steamcommunity.com/profiles/' + steamid, function(err, resp, body){
if (!err && resp.statusCode === 200) {
let dom = new JSDOM(body, { runScripts: "outside-only" })
let joinBtn = dom.window.document.querySelector('.profile_in_game_joingame a');
event.sender.send('inviteUrl', (joinBtn !== null)?joinBtn.href:'')
}
})
})

0 comments on commit 721203c

Please sign in to comment.