Skip to content

Commit 9bac58a

Browse files
committed
Updated README for the upcoming update.
1 parent 039da77 commit 9bac58a

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

README.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![NPM version](http://img.shields.io/npm/v/steam-groups.svg?style=flat)](https://www.npmjs.org/package/steam-groups)
44
[![Dependency Status](https://david-dm.org/scholtzm/node-steam-groups.svg?style=flat)](https://david-dm.org/scholtzm/node-steam-groups)
55

6-
This is a tiny node.js module which allows user to extend [node-steam](https://github.com/seishun/node-steam) to support group functions. This module therefore fully depends on [node-steam](https://github.com/seishun/node-steam).
6+
This is a tiny node.js module which provides custom [node-steam](https://github.com/seishun/node-steam) handler for group functions.
77

88
# Installation
99

@@ -13,54 +13,59 @@ npm install steam-groups
1313

1414
# Usage
1515

16-
Firstly, require `steam` module ...
16+
Firstly, require `steam` as well as `steam-groups` module ...
1717

1818
```js
1919
var Steam = require('steam');
20+
var SteamGroups = require('steam-groups');
2021
```
2122

22-
After that, simply extend `Steam` variable with `steam-groups` ...
23+
After that, instantiate SteamGroups by providing the Steam client instance as a constructor parameter ...
2324

2425
```js
25-
require('steam-groups')(Steam);
26+
var client = new Steam.SteamClient();
27+
var steamGroups = new SteamGroups(client);
2628
```
2729

2830
That's it. You can now use additional group functions.
2931

3032
# Functions
3133

32-
### groupInvite(steamIdGroup, steamIdInvited)
34+
### inviteUserToGroup(steamIdGroup, steamIdInvited)
3335

3436
Invite user `steamIdInvited` to group `steamIdGroup`. `steamIdGroup` has to be in `groupID64` format.
3537

3638
Example of `groupID64` can be found [here](http://steamcommunity.com/groups/tradingcards/memberslistxml/).
3739

38-
### acceptGroup(steamIdGroup)
39-
40-
Accept group invite. This can be used in conjunction with `node-steam`'s `group` event.
40+
### acknowledgeGroupInvite(steamIdGroup, response)
4141

42-
### declineGroup(steamIdGroup)
43-
44-
Decline group invite. This can be used in conjunction with `node-steam`'s `group` event.
42+
Accept or decline an invite to join group `steamIdGroup`. `response` is a `boolean` value. This can be used in conjunction with `node-steam`'s `group` event.
4543

4644
# Example
4745

4846
```js
49-
// Require node-steam first
47+
// Require node-steam and node-steam-groups first
5048
var Steam = require('steam');
49+
var SteamGroups = require('steam-groups');
5150

52-
// Extend node-steam with group functions
53-
require('steam-groups')(Steam);
54-
55-
// Create new SteamClient object
51+
// Create new SteamClient object and pass it as a constructor param
5652
var client = new Steam.SteamClient();
53+
var steamFriends = new Steam.SteamFriends(client);
54+
55+
var steamGroups = new SteamGroups(client);
5756

5857
// Call logOn and add additional code here ...
5958

6059
// This will work
61-
client.on('group', function(steamID, relationship) {
60+
steamFriends.on('group', function(group, relationship) {
6261
if(relationship === Steam.EClanRelationship.Invited) {
63-
client.acceptGroup(steamID);
62+
steamGroups.acknowledgeGroupInvite(group, true);
63+
}
64+
});
65+
66+
steamFriends.on('friendMsg', function(user, message, type) {
67+
if(type === Steam.EChatEntryType.ChatMsg) {
68+
steamGroups.inviteUserToGroup('1234567890', user);
6469
}
6570
});
6671
```

0 commit comments

Comments
 (0)