steamutils 1.4.11 → 1.4.13

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 +25 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3474,6 +3474,28 @@ export default class SteamUser {
3474
3474
  return this._respondToGroupInvite(groupSteamID, false);
3475
3475
  }
3476
3476
 
3477
+ async getGroupSteamIdFromVanilaURL(vanilaURL) {
3478
+ const result = await this._httpRequest({
3479
+ url: `groups/${vanilaURL}`,
3480
+ });
3481
+ if (result instanceof ResponseError) {
3482
+ return result;
3483
+ }
3484
+ const data = result?.data;
3485
+ if (!data || typeof data !== "string") return;
3486
+
3487
+ const match = data.match(/OpenGroupChat\(\s*'(\d+)'\s*\)/);
3488
+ if (match) {
3489
+ return match[1];
3490
+ }
3491
+
3492
+ const $ = cheerio.load(data);
3493
+ const id = $('form input[name="groupId"]').attr("value");
3494
+ if (id) {
3495
+ return id;
3496
+ }
3497
+ }
3498
+
3477
3499
  async leaveGroup(groupSteamID) {
3478
3500
  const result = await this._httpMyRequestAjax({
3479
3501
  url: `friends/action`,
@@ -3483,6 +3505,9 @@ export default class SteamUser {
3483
3505
  action: "leave_group",
3484
3506
  "steamids[]": groupSteamID,
3485
3507
  },
3508
+ headers: {
3509
+ "Content-Type": "multipart/form-data",
3510
+ },
3486
3511
  method: "POST",
3487
3512
  });
3488
3513
  if (result instanceof ResponseError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.4.11",
3
+ "version": "1.4.13",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",