steamutils 1.3.9 → 1.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +38 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1676,7 +1676,7 @@ class SteamUser {
1676
1676
 
1677
1677
  switch (response.status) {
1678
1678
  case 302: {
1679
- if(isRedirect){
1679
+ if (isRedirect) {
1680
1680
  redirectURL = response.headers.location
1681
1681
 
1682
1682
  if (redirectURL?.startsWith('https://steamcommunity.com/id/')) {
@@ -1731,7 +1731,7 @@ class SteamUser {
1731
1731
  }
1732
1732
  case 500: {
1733
1733
  console.log(response.status, response.statusText, config.url, response.data)
1734
- if(response.data){
1734
+ if (response.data) {
1735
1735
  return response
1736
1736
  }
1737
1737
  break
@@ -5790,7 +5790,7 @@ class SteamUser {
5790
5790
  url: `${this._myProfile}/tradeoffers/`,
5791
5791
  method: 'GET',
5792
5792
  })
5793
- if(!result?.data){
5793
+ if (!result?.data) {
5794
5794
  return
5795
5795
  }
5796
5796
  const $ = result._$()
@@ -6113,6 +6113,41 @@ class SteamUser {
6113
6113
  return {list, assets, success: true}
6114
6114
  }
6115
6115
  }
6116
+
6117
+ async getPlayerReports(token) {
6118
+ const param = {
6119
+ sessionid: this._sessionid,
6120
+ tab: "playerreports",
6121
+ ajax: 1,
6122
+ ...(!!token && {continue_token: token})
6123
+ }
6124
+ const data = (await this._httpRequestAjax({
6125
+ url: `my/gcpd/730?${Object.keys(param).map(k => `${k}=${param[k]}`).join('&')}`,
6126
+ }))?.data
6127
+ if (data.success !== true) {
6128
+ return
6129
+ }
6130
+ const {
6131
+ success,
6132
+ html,
6133
+ continue_token,
6134
+ continue_text
6135
+ } = data
6136
+ const $ = cheerio.load(StringUtils.cleanSpace(html))
6137
+ const json = table2json($, $('table'))
6138
+ if (Array.isArray(json)) {
6139
+ json.forEach(function (row) {
6140
+ row.Timestamp = moment.utc(row.Time.replace('GMT', '').trim(), 'YYYY-MM-DD HH:mm:ss', true).valueOf()
6141
+ })
6142
+ return json
6143
+ }
6144
+ /*const exampleData = [{
6145
+ "Time": "2023-11-11 19:34:42 GMT",
6146
+ Timestamp: 1699731282000,
6147
+ "Reported Player": "N1k0-",
6148
+ "Report Details": "You reported this player for: Aim HackingWall Hacking"
6149
+ }]*/
6150
+ }
6116
6151
  }
6117
6152
 
6118
6153
  function querySelectorAll($, selector, root) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.09",
3
+ "version": "1.3.10",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.5",