bedrock-portal 0.7.3 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +285 -260
- package/dist/classes/Host.js +2 -2
- package/dist/common/util.d.ts +2 -0
- package/dist/common/util.js +14 -0
- package/dist/handlers/Event.js +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +14 -17
- package/dist/modules/autoFriendAccept.d.ts +7 -0
- package/dist/modules/autoFriendAccept.js +54 -0
- package/dist/rest.d.ts +4 -0
- package/dist/rest.js +14 -2
- package/dist/types/peoplehub.d.ts +82 -24
- package/dist/types/peoplehub.js +1 -15
- package/dist/types/social.d.ts +4 -0
- package/dist/types/social.js +2 -0
- package/package.json +44 -44
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,260 +1,285 @@
|
|
|
1
|
-
# BedrockPortal
|
|
2
|
-
[](http://npmjs.com/package/bedrock-portal)
|
|
3
|
-
[](https://discord.gg/KTyd9HWuBD)
|
|
4
|
-
|
|
5
|
-
Handles and creates a Minecraft Bedrock game session which will redirect players to the specified server. Join our [Discord](https://discord.com/invite/KTyd9HWuBD) for support.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
```shell
|
|
9
|
-
npm install bedrock-portal
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
### Warning
|
|
13
|
-
This package is not meant to be used with your main account. It is meant to be used with alt accounts. If you use this package with your main account, you may be banned from the XSAPI. This package is not affiliated with Mojang or Microsoft.
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
### BedrockPortal(authflow, options)
|
|
18
|
-
**Parameters**
|
|
19
|
-
- authflow - Takes an **Authflow** instance from [prismarine-auth](https://github.com/PrismarineJS/prismarine-auth), you can see the documentation for this [here.](https://github.com/PrismarineJS/prismarine-auth#authflow)
|
|
20
|
-
- options
|
|
21
|
-
- **ip** - The IP address of the server to redirect players to (required)
|
|
22
|
-
- **port** - The port of the server to redirect players to | default: 19132
|
|
23
|
-
- **joinability** - The joinability of the session | default: FriendsOfFriends
|
|
24
|
-
- **world** - The world config to use for the session. Changes the session card which is displayed in the Minecraft client. (optional)
|
|
25
|
-
- **hostName** - string
|
|
26
|
-
- **name** - string
|
|
27
|
-
- **version** - string
|
|
28
|
-
- **memberCount** - number
|
|
29
|
-
- **maxMemberCount** - number
|
|
30
|
-
|
|
31
|
-
### Create a session redirect to a server
|
|
32
|
-
```js
|
|
33
|
-
const { BedrockPortal, Joinability } = require('bedrock-portal');
|
|
34
|
-
const { Authflow, Titles } = require('prismarine-auth');
|
|
35
|
-
|
|
36
|
-
const main = async () => {
|
|
37
|
-
const auth = new Authflow('example', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo', flow: 'live' });
|
|
38
|
-
|
|
39
|
-
const portal = new BedrockPortal(auth, {
|
|
40
|
-
// The server IP & port to redirect players to
|
|
41
|
-
ip: 'geyserconnect.net',
|
|
42
|
-
port: 19132,
|
|
43
|
-
|
|
44
|
-
// The joinability of the session. Joinability.FriendsOfFriends, Joinability.FriendsOnly, Joinability.InviteOnly
|
|
45
|
-
joinability: Joinability.FriendsOfFriends
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
await portal.start();
|
|
49
|
-
|
|
50
|
-
// accepts a player's gamertag or xuid
|
|
51
|
-
await portal.invitePlayer('p3')
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
main();
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Modules
|
|
59
|
-
|
|
60
|
-
Modules are used to extend the functionality of the BedrockPortal class.
|
|
61
|
-
|
|
62
|
-
### MultipleAccounts
|
|
63
|
-
|
|
64
|
-
Allows the portal to use multiple accounts to redirect players to the server. `#.use(Modules.MultipleAccounts, options);`
|
|
65
|
-
|
|
66
|
-
Options:
|
|
67
|
-
- **accounts**: Authflow[] - An array of authflows from [prismarine-auth](https://github.com/PrismarineJS/prismarine-auth), these accounts are automatically added to the host session and allows players to add them as a friend to join the game. (required)
|
|
68
|
-
|
|
69
|
-
```js
|
|
70
|
-
const { Authflow, Titles } = require('prismarine-auth')
|
|
71
|
-
const { BedrockPortal, Modules } = require('bedrock-portal')
|
|
72
|
-
|
|
73
|
-
const main = async () => {
|
|
74
|
-
const auth = new Authflow('example', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo', flow: 'live' })
|
|
75
|
-
|
|
76
|
-
const portal = new BedrockPortal(auth, {
|
|
77
|
-
ip: 'geyserconnect.net',
|
|
78
|
-
port: 19132,
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
portal.use(Modules.AutoFriendAdd, {
|
|
82
|
-
inviteOnAdd: true,
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
portal.use(Modules.MultipleAccounts, {
|
|
86
|
-
accounts: [
|
|
87
|
-
new Authflow('account1', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo', flow: 'live' }),
|
|
88
|
-
new Authflow('account2', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo', flow: 'live' }),
|
|
89
|
-
],
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
await portal.start()
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
main()
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
### RedirectFromRealm
|
|
100
|
-
|
|
101
|
-
> Requires [bedrock-protocol](https://github.com/PrismarineJS/bedrock-protocol) to be installed. `npm install bedrock-protocol`
|
|
102
|
-
|
|
103
|
-
Invites players when they join a Realm to the specified server or if they use the chat command. `#.use(Modules.redirectFromRealm, options);`
|
|
104
|
-
|
|
105
|
-
Options:
|
|
106
|
-
- **clientOptions**: ClientOptions - The client options to use when connecting to the Realm. These are passed directly to a [bedrock-protocol createClient](https://github.com/PrismarineJS/bedrock-protocol/blob/master/docs/API.md#becreateclientoptions--client) function. See the documentation for more information.
|
|
107
|
-
- **chatCommand**: object - Options for the chat command
|
|
108
|
-
- **enabled**: boolean - Whether sending the command in chat should trigger an invite (default: true)
|
|
109
|
-
- **message**: string - The message to send in chat to run the command (default: 'invite')
|
|
110
|
-
- **cooldown**: number - The cooldown between being able to send the command in chat (default: 60000ms)
|
|
111
|
-
|
|
112
|
-
```js
|
|
113
|
-
const { BedrockPortal, Modules } = require('bedrock-portal');
|
|
114
|
-
|
|
115
|
-
const portal = new BedrockPortal(auth, { ... })
|
|
116
|
-
|
|
117
|
-
portal.use(Modules.RedirectFromRealm, {
|
|
118
|
-
// The client options to use when connecting to the Realm.
|
|
119
|
-
clientOptions: {
|
|
120
|
-
realms: {
|
|
121
|
-
realmInvite: ''
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
// Options for the chat command
|
|
125
|
-
chatCommand: {
|
|
126
|
-
// Whether sending the command in chat should trigger an invite (optional - defaults to true)
|
|
127
|
-
enabled: true,
|
|
128
|
-
// The message to send in chat to run the command (optional - defaults to 'invite')
|
|
129
|
-
message: 'invite',
|
|
130
|
-
// The cooldown between being able to send the command in chat (optional - defaults to 60000ms)
|
|
131
|
-
cooldown: 60000,
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### AutoFriendAdd
|
|
137
|
-
|
|
138
|
-
Automatically adds the account's followers as friends and invites them to the game. `#.use(Modules.autoFriendAdd);`
|
|
139
|
-
|
|
140
|
-
Options:
|
|
141
|
-
- **inviteOnAdd**: boolean - Automatically invites recently added friends to the game (default: false)
|
|
142
|
-
- **conditionToMeet**: (player: RawPlayer) => boolean - A function that returns a boolean. If the function returns true, followers will be added as a friend and the friends that don't will be removed (default: () => true)
|
|
143
|
-
- **checkInterval**: number - How often to check for friends to add/remove (default: 30000ms)
|
|
144
|
-
- **addInterval**: number - How long to wait between adding friends (default: 2000ms)
|
|
145
|
-
- **removeInterval**: number - How long to wait between removing friends (default: 2000ms)
|
|
146
|
-
|
|
147
|
-
```js
|
|
148
|
-
const { BedrockPortal, Modules } = require('bedrock-portal');
|
|
149
|
-
|
|
150
|
-
const portal = new BedrockPortal(auth, { ... })
|
|
151
|
-
|
|
152
|
-
portal.use(Modules.AutoFriendAdd);
|
|
153
|
-
|
|
154
|
-
// or
|
|
155
|
-
|
|
156
|
-
portal.use(Modules.AutoFriendAdd, {
|
|
157
|
-
// When a friend is added, automatically invite them to the game
|
|
158
|
-
inviteOnAdd: true,
|
|
159
|
-
// Only add friends that are online and remove friends that are offline
|
|
160
|
-
conditionToMeet: (player) => player.presenceState === 'Online',
|
|
161
|
-
// How often to check for friends to add/remove (optional - defaults to 30000ms)
|
|
162
|
-
checkInterval: 30000,
|
|
163
|
-
// How long to wait between adding friends (optional - defaults to 2000ms)
|
|
164
|
-
addInterval: 2000,
|
|
165
|
-
// How long to wait between removing friends (optional - defaults to 2000ms)
|
|
166
|
-
removeInterval: 2000,
|
|
167
|
-
});
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
###
|
|
171
|
-
|
|
172
|
-
Automatically
|
|
173
|
-
|
|
174
|
-
Options:
|
|
175
|
-
- **
|
|
176
|
-
- **
|
|
177
|
-
|
|
178
|
-
```js
|
|
179
|
-
const { BedrockPortal, Modules } = require('bedrock-portal');
|
|
180
|
-
|
|
181
|
-
const portal = new BedrockPortal(auth, { ... })
|
|
182
|
-
|
|
183
|
-
portal.use(Modules.
|
|
184
|
-
|
|
185
|
-
// or
|
|
186
|
-
|
|
187
|
-
portal.use(Modules.
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
//
|
|
191
|
-
|
|
192
|
-
});
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
portal.use(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
1
|
+
# BedrockPortal
|
|
2
|
+
[](http://npmjs.com/package/bedrock-portal)
|
|
3
|
+
[](https://discord.gg/KTyd9HWuBD)
|
|
4
|
+
|
|
5
|
+
Handles and creates a Minecraft Bedrock game session which will redirect players to the specified server. Join our [Discord](https://discord.com/invite/KTyd9HWuBD) for support.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
```shell
|
|
9
|
+
npm install bedrock-portal
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Warning
|
|
13
|
+
This package is not meant to be used with your main account. It is meant to be used with alt accounts. If you use this package with your main account, you may be banned from the XSAPI. This package is not affiliated with Mojang or Microsoft.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### BedrockPortal(authflow, options)
|
|
18
|
+
**Parameters**
|
|
19
|
+
- authflow - Takes an **Authflow** instance from [prismarine-auth](https://github.com/PrismarineJS/prismarine-auth), you can see the documentation for this [here.](https://github.com/PrismarineJS/prismarine-auth#authflow)
|
|
20
|
+
- options
|
|
21
|
+
- **ip** - The IP address of the server to redirect players to (required)
|
|
22
|
+
- **port** - The port of the server to redirect players to | default: 19132
|
|
23
|
+
- **joinability** - The joinability of the session | default: FriendsOfFriends
|
|
24
|
+
- **world** - The world config to use for the session. Changes the session card which is displayed in the Minecraft client. (optional)
|
|
25
|
+
- **hostName** - string
|
|
26
|
+
- **name** - string
|
|
27
|
+
- **version** - string
|
|
28
|
+
- **memberCount** - number
|
|
29
|
+
- **maxMemberCount** - number
|
|
30
|
+
|
|
31
|
+
### Create a session redirect to a server
|
|
32
|
+
```js
|
|
33
|
+
const { BedrockPortal, Joinability } = require('bedrock-portal');
|
|
34
|
+
const { Authflow, Titles } = require('prismarine-auth');
|
|
35
|
+
|
|
36
|
+
const main = async () => {
|
|
37
|
+
const auth = new Authflow('example', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo', flow: 'live' });
|
|
38
|
+
|
|
39
|
+
const portal = new BedrockPortal(auth, {
|
|
40
|
+
// The server IP & port to redirect players to
|
|
41
|
+
ip: 'geyserconnect.net',
|
|
42
|
+
port: 19132,
|
|
43
|
+
|
|
44
|
+
// The joinability of the session. Joinability.FriendsOfFriends, Joinability.FriendsOnly, Joinability.InviteOnly
|
|
45
|
+
joinability: Joinability.FriendsOfFriends
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
await portal.start();
|
|
49
|
+
|
|
50
|
+
// accepts a player's gamertag or xuid
|
|
51
|
+
await portal.invitePlayer('p3')
|
|
52
|
+
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
main();
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Modules
|
|
59
|
+
|
|
60
|
+
Modules are used to extend the functionality of the BedrockPortal class.
|
|
61
|
+
|
|
62
|
+
### MultipleAccounts
|
|
63
|
+
|
|
64
|
+
Allows the portal to use multiple accounts to redirect players to the server. `#.use(Modules.MultipleAccounts, options);`
|
|
65
|
+
|
|
66
|
+
Options:
|
|
67
|
+
- **accounts**: Authflow[] - An array of authflows from [prismarine-auth](https://github.com/PrismarineJS/prismarine-auth), these accounts are automatically added to the host session and allows players to add them as a friend to join the game. (required)
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
const { Authflow, Titles } = require('prismarine-auth')
|
|
71
|
+
const { BedrockPortal, Modules } = require('bedrock-portal')
|
|
72
|
+
|
|
73
|
+
const main = async () => {
|
|
74
|
+
const auth = new Authflow('example', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo', flow: 'live' })
|
|
75
|
+
|
|
76
|
+
const portal = new BedrockPortal(auth, {
|
|
77
|
+
ip: 'geyserconnect.net',
|
|
78
|
+
port: 19132,
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
portal.use(Modules.AutoFriendAdd, {
|
|
82
|
+
inviteOnAdd: true,
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
portal.use(Modules.MultipleAccounts, {
|
|
86
|
+
accounts: [
|
|
87
|
+
new Authflow('account1', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo', flow: 'live' }),
|
|
88
|
+
new Authflow('account2', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo', flow: 'live' }),
|
|
89
|
+
],
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
await portal.start()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
main()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### RedirectFromRealm
|
|
100
|
+
|
|
101
|
+
> Requires [bedrock-protocol](https://github.com/PrismarineJS/bedrock-protocol) to be installed. `npm install bedrock-protocol`
|
|
102
|
+
|
|
103
|
+
Invites players when they join a Realm to the specified server or if they use the chat command. `#.use(Modules.redirectFromRealm, options);`
|
|
104
|
+
|
|
105
|
+
Options:
|
|
106
|
+
- **clientOptions**: ClientOptions - The client options to use when connecting to the Realm. These are passed directly to a [bedrock-protocol createClient](https://github.com/PrismarineJS/bedrock-protocol/blob/master/docs/API.md#becreateclientoptions--client) function. See the documentation for more information.
|
|
107
|
+
- **chatCommand**: object - Options for the chat command
|
|
108
|
+
- **enabled**: boolean - Whether sending the command in chat should trigger an invite (default: true)
|
|
109
|
+
- **message**: string - The message to send in chat to run the command (default: 'invite')
|
|
110
|
+
- **cooldown**: number - The cooldown between being able to send the command in chat (default: 60000ms)
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
const { BedrockPortal, Modules } = require('bedrock-portal');
|
|
114
|
+
|
|
115
|
+
const portal = new BedrockPortal(auth, { ... })
|
|
116
|
+
|
|
117
|
+
portal.use(Modules.RedirectFromRealm, {
|
|
118
|
+
// The client options to use when connecting to the Realm.
|
|
119
|
+
clientOptions: {
|
|
120
|
+
realms: {
|
|
121
|
+
realmInvite: ''
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
// Options for the chat command
|
|
125
|
+
chatCommand: {
|
|
126
|
+
// Whether sending the command in chat should trigger an invite (optional - defaults to true)
|
|
127
|
+
enabled: true,
|
|
128
|
+
// The message to send in chat to run the command (optional - defaults to 'invite')
|
|
129
|
+
message: 'invite',
|
|
130
|
+
// The cooldown between being able to send the command in chat (optional - defaults to 60000ms)
|
|
131
|
+
cooldown: 60000,
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### AutoFriendAdd
|
|
137
|
+
|
|
138
|
+
Automatically adds the account's followers as friends and invites them to the game. `#.use(Modules.autoFriendAdd);`
|
|
139
|
+
|
|
140
|
+
Options:
|
|
141
|
+
- **inviteOnAdd**: boolean - Automatically invites recently added friends to the game (default: false)
|
|
142
|
+
- **conditionToMeet**: (player: RawPlayer) => boolean - A function that returns a boolean. If the function returns true, followers will be added as a friend and the friends that don't will be removed (default: () => true)
|
|
143
|
+
- **checkInterval**: number - How often to check for friends to add/remove (default: 30000ms)
|
|
144
|
+
- **addInterval**: number - How long to wait between adding friends (default: 2000ms)
|
|
145
|
+
- **removeInterval**: number - How long to wait between removing friends (default: 2000ms)
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
const { BedrockPortal, Modules } = require('bedrock-portal');
|
|
149
|
+
|
|
150
|
+
const portal = new BedrockPortal(auth, { ... })
|
|
151
|
+
|
|
152
|
+
portal.use(Modules.AutoFriendAdd);
|
|
153
|
+
|
|
154
|
+
// or
|
|
155
|
+
|
|
156
|
+
portal.use(Modules.AutoFriendAdd, {
|
|
157
|
+
// When a friend is added, automatically invite them to the game
|
|
158
|
+
inviteOnAdd: true,
|
|
159
|
+
// Only add friends that are online and remove friends that are offline
|
|
160
|
+
conditionToMeet: (player) => player.presenceState === 'Online',
|
|
161
|
+
// How often to check for friends to add/remove (optional - defaults to 30000ms)
|
|
162
|
+
checkInterval: 30000,
|
|
163
|
+
// How long to wait between adding friends (optional - defaults to 2000ms)
|
|
164
|
+
addInterval: 2000,
|
|
165
|
+
// How long to wait between removing friends (optional - defaults to 2000ms)
|
|
166
|
+
removeInterval: 2000,
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### AutoFriendAccept
|
|
171
|
+
|
|
172
|
+
Automatically accepts friend requests sent to the account. `#.use(Modules.autoFriendAdd);`
|
|
173
|
+
|
|
174
|
+
Options:
|
|
175
|
+
- **inviteOnAdd**: boolean - Automatically invites added friends to the game (default: false)
|
|
176
|
+
- **conditionToMeet**: (player: Player) => boolean - If the function returns true then the request will be accepted (default: () => true)
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
const { BedrockPortal, Modules } = require('bedrock-portal');
|
|
180
|
+
|
|
181
|
+
const portal = new BedrockPortal(auth, { ... })
|
|
182
|
+
|
|
183
|
+
portal.use(Modules.AutoFriendAccept);
|
|
184
|
+
|
|
185
|
+
// or
|
|
186
|
+
|
|
187
|
+
portal.use(Modules.AutoFriendAccept, {
|
|
188
|
+
// When a friend is added invite them to the game
|
|
189
|
+
inviteOnAdd: true,
|
|
190
|
+
// Only accept friends that have 'elite' in their gamertag
|
|
191
|
+
conditionToMeet: (player) => player.gamertag.includes('elite'),
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### InviteOnMessage
|
|
196
|
+
|
|
197
|
+
Automatically invites players to the game when they send a message in the chat. `#.use(Modules.inviteOnMessage);`
|
|
198
|
+
|
|
199
|
+
Options:
|
|
200
|
+
- **command**: string - The command to use to invite players (default: 'invite')
|
|
201
|
+
- **checkInterval**: number - How often to check for messages (default: 30000ms)
|
|
202
|
+
|
|
203
|
+
```js
|
|
204
|
+
const { BedrockPortal, Modules } = require('bedrock-portal');
|
|
205
|
+
|
|
206
|
+
const portal = new BedrockPortal(auth, { ... })
|
|
207
|
+
|
|
208
|
+
portal.use(Modules.InviteOnMessage);
|
|
209
|
+
|
|
210
|
+
// or
|
|
211
|
+
|
|
212
|
+
portal.use(Modules.InviteOnMessage, {
|
|
213
|
+
// The command to use to invite players (optional - defaults to 'invite')
|
|
214
|
+
command: 'invite',
|
|
215
|
+
// How often to check for messages (optional - defaults to 30000ms)
|
|
216
|
+
checkInterval: 30000,
|
|
217
|
+
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Modules API
|
|
221
|
+
|
|
222
|
+
Creating a module is easy. You can create a module by extending the `Module` class.
|
|
223
|
+
|
|
224
|
+
Note: The `stopped` property is set to `true` when the portal is stopped. You can use this to stop the module's loop (if one is present) else the process will not exit.
|
|
225
|
+
|
|
226
|
+
```js
|
|
227
|
+
const { Module } = require('bedrock-portal');
|
|
228
|
+
|
|
229
|
+
const myModule = class MyModule extends Module {
|
|
230
|
+
constructor() {
|
|
231
|
+
super('myModule', 'Description of my module');
|
|
232
|
+
this.options = {
|
|
233
|
+
option1: true,
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
async run(portal) {
|
|
238
|
+
// portal - The BedrockPortal instance
|
|
239
|
+
|
|
240
|
+
// Do stuff here
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async stop() {
|
|
244
|
+
super.stop();
|
|
245
|
+
// Do stuff when the module is stopped
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
portal.use(myModule, {
|
|
250
|
+
option1: false,
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Events
|
|
256
|
+
|
|
257
|
+
### portal.on('sessionCreated', (session) => void)
|
|
258
|
+
Emitted when a session is created.
|
|
259
|
+
|
|
260
|
+
### portal.on('sessionUpdated', (session) => void)
|
|
261
|
+
Emitted when a session is updated.
|
|
262
|
+
|
|
263
|
+
### portal.on('playerJoin', (player) => void)
|
|
264
|
+
Emitted when a player joins the session.
|
|
265
|
+
|
|
266
|
+
### portal.on('playerLeave', (player) => void)
|
|
267
|
+
Emitted when a player leaves the session.
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
### portal.on('friendAdded', (player) => void)
|
|
271
|
+
Emitted when a player is added as a friend. This event is only emitted when the `autoFriendAdd` module is enabled.
|
|
272
|
+
|
|
273
|
+
### portal.on('friendRemoved', (player) => void)
|
|
274
|
+
Emitted when a player is removed as a friend. This event is only emitted when the `autoFriendAdd` module is enabled.
|
|
275
|
+
|
|
276
|
+
### portal.on('messageRecieved', (message) => void)
|
|
277
|
+
Emitted when a message is recieved from a player. This event is only emitted when the `inviteOnMessage` module is enabled.
|
|
278
|
+
|
|
279
|
+
## Debugging
|
|
280
|
+
|
|
281
|
+
You can enable some debugging output using the `DEBUG` enviroment variable. Through node.js, you can add `process.env.DEBUG = 'bedrock-portal*'` at the top of your code.
|
|
282
|
+
|
|
283
|
+
## License
|
|
284
|
+
|
|
285
|
+
[MIT](LICENSE)
|
package/dist/classes/Host.js
CHANGED
|
@@ -31,9 +31,9 @@ class Host {
|
|
|
31
31
|
this.rta.on('subscribe', (event) => this.onSubscribe(event));
|
|
32
32
|
}
|
|
33
33
|
async onSubscribe(event) {
|
|
34
|
-
|
|
35
|
-
const connectionId = event.data.ConnectionId;
|
|
34
|
+
const connectionId = event.data?.ConnectionId;
|
|
36
35
|
if (connectionId && typeof connectionId === 'string') {
|
|
36
|
+
debug('Received RTA subscribe event', event);
|
|
37
37
|
try {
|
|
38
38
|
this.connectionId = connectionId;
|
|
39
39
|
await this.rest.updateConnection(this.portal.session.name, connectionId);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRandomUint64 = exports.isXuid = void 0;
|
|
4
|
+
const isXuid = (xuid) => /^\d{16}$/.test(xuid);
|
|
5
|
+
exports.isXuid = isXuid;
|
|
6
|
+
const getRandomUint64 = () => {
|
|
7
|
+
// Generate two 32-bit random integers
|
|
8
|
+
const high = Math.floor(Math.random() * 0xFFFFFFFF);
|
|
9
|
+
const low = Math.floor(Math.random() * 0xFFFFFFFF);
|
|
10
|
+
// Combine them to create a 64-bit unsigned integer
|
|
11
|
+
const result = (BigInt(high) << BigInt(32)) | BigInt(low);
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
exports.getRandomUint64 = getRandomUint64;
|
package/dist/handlers/Event.js
CHANGED
|
@@ -7,6 +7,8 @@ const debug_1 = __importDefault(require("debug"));
|
|
|
7
7
|
const Player_1 = __importDefault(require("../classes/Player"));
|
|
8
8
|
const debug = (0, debug_1.default)('bedrock-portal');
|
|
9
9
|
exports.default = async (portal, event) => {
|
|
10
|
+
if (!event.data.ncid)
|
|
11
|
+
return;
|
|
10
12
|
portal.emit('rtaEvent', event);
|
|
11
13
|
const session = await portal.getSession();
|
|
12
14
|
portal.emit('sessionUpdated', session);
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import Host from './classes/Host';
|
|
|
7
7
|
import Player from './classes/Player';
|
|
8
8
|
import Module from './classes/Module';
|
|
9
9
|
import { Joinability } from './common/constants';
|
|
10
|
-
import AutoFriendAdd from './modules/
|
|
10
|
+
import AutoFriendAdd from './modules/autoFriendAccept';
|
|
11
11
|
import InviteOnMessage from './modules/inviteOnMessage';
|
|
12
12
|
import RedirectFromRealm from './modules/redirectFromRealm';
|
|
13
13
|
import MultipleAccounts from './modules/multipleAccounts';
|
|
@@ -149,5 +149,6 @@ declare const Modules: {
|
|
|
149
149
|
InviteOnMessage: typeof InviteOnMessage;
|
|
150
150
|
RedirectFromRealm: typeof RedirectFromRealm;
|
|
151
151
|
MultipleAccounts: typeof MultipleAccounts;
|
|
152
|
+
AutoFriendAccept: typeof AutoFriendAdd;
|
|
152
153
|
};
|
|
153
154
|
export { Modules };
|
package/dist/index.js
CHANGED
|
@@ -7,26 +7,20 @@ exports.Modules = exports.Module = exports.Joinability = exports.BedrockPortal =
|
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
8
|
const uuid_1 = require("uuid");
|
|
9
9
|
const tiny_typed_emitter_1 = require("tiny-typed-emitter");
|
|
10
|
+
const bedrock_portal_nethernet_1 = require("bedrock-portal-nethernet");
|
|
10
11
|
const Host_1 = __importDefault(require("./classes/Host"));
|
|
11
12
|
const Module_1 = __importDefault(require("./classes/Module"));
|
|
12
13
|
exports.Module = Module_1.default;
|
|
13
14
|
const constants_1 = require("./common/constants");
|
|
14
15
|
const Event_1 = __importDefault(require("./handlers/Event"));
|
|
15
|
-
const
|
|
16
|
+
const autoFriendAccept_1 = __importDefault(require("./modules/autoFriendAccept"));
|
|
16
17
|
const inviteOnMessage_1 = __importDefault(require("./modules/inviteOnMessage"));
|
|
17
18
|
const redirectFromRealm_1 = __importDefault(require("./modules/redirectFromRealm"));
|
|
18
19
|
const multipleAccounts_1 = __importDefault(require("./modules/multipleAccounts"));
|
|
20
|
+
const autoFriendAccept_2 = __importDefault(require("./modules/autoFriendAccept"));
|
|
19
21
|
const start_game_1 = require("./common/start_game");
|
|
20
|
-
const
|
|
22
|
+
const util_1 = require("./common/util");
|
|
21
23
|
const debug = (0, debug_1.default)('bedrock-portal');
|
|
22
|
-
const getRandomUint64 = () => {
|
|
23
|
-
// Generate two 32-bit random integers
|
|
24
|
-
const high = Math.floor(Math.random() * 0xFFFFFFFF);
|
|
25
|
-
const low = Math.floor(Math.random() * 0xFFFFFFFF);
|
|
26
|
-
// Combine them to create a 64-bit unsigned integer
|
|
27
|
-
const result = (BigInt(high) << BigInt(32)) | BigInt(low);
|
|
28
|
-
return result;
|
|
29
|
-
};
|
|
30
24
|
class BedrockPortal extends tiny_typed_emitter_1.TypedEmitter {
|
|
31
25
|
authflow;
|
|
32
26
|
host;
|
|
@@ -40,7 +34,7 @@ class BedrockPortal extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
40
34
|
ip: '',
|
|
41
35
|
port: 19132,
|
|
42
36
|
joinability: constants_1.Joinability.FriendsOfFriends,
|
|
43
|
-
webRTCNetworkId: getRandomUint64(),
|
|
37
|
+
webRTCNetworkId: (0, util_1.getRandomUint64)(),
|
|
44
38
|
...options,
|
|
45
39
|
world: {
|
|
46
40
|
hostName: 'Bedrock Portal v0.6.0',
|
|
@@ -130,11 +124,13 @@ class BedrockPortal extends tiny_typed_emitter_1.TypedEmitter {
|
|
|
130
124
|
*/
|
|
131
125
|
async invitePlayer(identifier) {
|
|
132
126
|
debug(`Inviting player, identifier: ${identifier}`);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
127
|
+
if (!(0, util_1.isXuid)(identifier)) {
|
|
128
|
+
const profile = await this.host.rest.getProfile(identifier)
|
|
129
|
+
.catch(() => { throw new Error(`Failed to get profile for identifier: ${identifier}`); });
|
|
130
|
+
identifier = profile.xuid;
|
|
131
|
+
}
|
|
132
|
+
await this.host.rest.sendInvite(this.session.name, identifier);
|
|
133
|
+
debug(`Invited player, xuid: ${identifier}`);
|
|
138
134
|
}
|
|
139
135
|
/**
|
|
140
136
|
* Updates the current member count which is displayed in the Minecraft client.
|
|
@@ -253,9 +249,10 @@ exports.BedrockPortal = BedrockPortal;
|
|
|
253
249
|
var constants_2 = require("./common/constants");
|
|
254
250
|
Object.defineProperty(exports, "Joinability", { enumerable: true, get: function () { return constants_2.Joinability; } });
|
|
255
251
|
const Modules = {
|
|
256
|
-
AutoFriendAdd:
|
|
252
|
+
AutoFriendAdd: autoFriendAccept_1.default,
|
|
257
253
|
InviteOnMessage: inviteOnMessage_1.default,
|
|
258
254
|
RedirectFromRealm: redirectFromRealm_1.default,
|
|
259
255
|
MultipleAccounts: multipleAccounts_1.default,
|
|
256
|
+
AutoFriendAccept: autoFriendAccept_2.default,
|
|
260
257
|
};
|
|
261
258
|
exports.Modules = Modules;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const Module_1 = __importDefault(require("../classes/Module"));
|
|
7
|
+
const Player_1 = __importDefault(require("../classes/Player"));
|
|
8
|
+
const multipleAccounts_1 = __importDefault(require("./multipleAccounts"));
|
|
9
|
+
class AutoFriendAdd extends Module_1.default {
|
|
10
|
+
constructor() {
|
|
11
|
+
super('autoFriendAdd', 'Automatically accept friend requests');
|
|
12
|
+
this.options = {
|
|
13
|
+
inviteOnAdd: false,
|
|
14
|
+
conditionToMeet: () => true,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
async run(portal) {
|
|
18
|
+
const addXboxFriend = async (host) => {
|
|
19
|
+
host.rta?.on('event', async (event) => {
|
|
20
|
+
if (event.data.NotificationType !== 'IncomingFriendRequestCountChanged')
|
|
21
|
+
return;
|
|
22
|
+
this.debug('Received Friend RTA event', event);
|
|
23
|
+
const requests = await host.rest.getFriendRequestsReceived()
|
|
24
|
+
.then(res => res.filter(this.options.conditionToMeet));
|
|
25
|
+
this.debug(`Received ${requests.length} friend request(s)`);
|
|
26
|
+
if (!requests.length)
|
|
27
|
+
return;
|
|
28
|
+
const accept = await host.rest.acceptFriendRequests(requests.map(req => req.xuid));
|
|
29
|
+
this.debug(`Accepted ${accept.updatedPeople.length} friend request(s)`);
|
|
30
|
+
for (const person of requests.filter(req => accept.updatedPeople.includes(req.xuid))) {
|
|
31
|
+
portal.emit('friendAdded', new Player_1.default(person, null));
|
|
32
|
+
this.debug(`Accepted ${person.gamertag}`);
|
|
33
|
+
if (this.options.inviteOnAdd) {
|
|
34
|
+
await portal.invitePlayer(person.xuid).catch(error => this.debug(`Error: Failed to invite ${person.gamertag}`, error));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
await host.rta?.subscribe(`https://social.xboxlive.com/users/xuid(${host.profile?.xuid})/friends`);
|
|
39
|
+
};
|
|
40
|
+
const multipleAccounts = portal.modules.get('multipleAccounts');
|
|
41
|
+
if (multipleAccounts && multipleAccounts instanceof multipleAccounts_1.default) {
|
|
42
|
+
for (const account of multipleAccounts.peers.values()) {
|
|
43
|
+
addXboxFriend(account)
|
|
44
|
+
.catch(error => this.debug(`Error: ${error.message}`, error));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
addXboxFriend(portal.host)
|
|
48
|
+
.catch(error => this.debug(`Error: ${error.message}`, error));
|
|
49
|
+
}
|
|
50
|
+
async stop() {
|
|
51
|
+
super.stop();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.default = AutoFriendAdd;
|
package/dist/rest.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { AxiosRequestConfig } from 'axios';
|
|
|
2
2
|
import { Authflow } from 'prismarine-auth';
|
|
3
3
|
import { RESTXblmessageInboxResponse } from './types/xblmessaging';
|
|
4
4
|
import { SessionRequest, RESTSessionResponse, SessionHandlePayload } from './types/sessiondirectory';
|
|
5
|
+
import { RESTSocialPostBulkFriendRequestResponse } from './types/social';
|
|
5
6
|
type RequestHeaders = {
|
|
6
7
|
[x: string]: string | boolean | number | undefined;
|
|
7
8
|
};
|
|
@@ -39,6 +40,9 @@ export default class Rest {
|
|
|
39
40
|
getProfiles(xuids: string[]): Promise<import("./types/peoplehub").Person[]>;
|
|
40
41
|
getXboxFriends(): Promise<import("./types/peoplehub").Person[]>;
|
|
41
42
|
getXboxFollowers(): Promise<import("./types/peoplehub").Person[]>;
|
|
43
|
+
getFriendRequestsReceived(): Promise<import("./types/peoplehub").FriendRequestPerson[]>;
|
|
44
|
+
acceptFriendRequests(xuids: string[]): Promise<RESTSocialPostBulkFriendRequestResponse>;
|
|
45
|
+
declineFriendRequests(xuids: string[]): Promise<RESTSocialPostBulkFriendRequestResponse>;
|
|
42
46
|
addXboxFriend(xuid: string): Promise<void>;
|
|
43
47
|
removeXboxFriend(xuid: string): Promise<void>;
|
|
44
48
|
getInboxMessages(inbox: 'primary' | 'secondary'): Promise<RESTXblmessageInboxResponse>;
|
package/dist/rest.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const axios_1 = __importDefault(require("axios"));
|
|
7
7
|
const json_bigint_1 = require("json-bigint");
|
|
8
8
|
const constants_1 = require("./common/constants");
|
|
9
|
+
const util_1 = require("./common/util");
|
|
9
10
|
class Rest {
|
|
10
11
|
auth;
|
|
11
12
|
options;
|
|
@@ -112,8 +113,7 @@ class Rest {
|
|
|
112
113
|
}
|
|
113
114
|
async getProfile(input) {
|
|
114
115
|
let xuid = input;
|
|
115
|
-
|
|
116
|
-
if (!isXuid) {
|
|
116
|
+
if (!(0, util_1.isXuid)(input)) {
|
|
117
117
|
const target = input === 'me' ? 'me' : `gt(${encodeURIComponent(input)})`;
|
|
118
118
|
const response = await this.get(`https://profile.xboxlive.com/users/${target}/settings`, { contractVersion: '2' });
|
|
119
119
|
xuid = response.profileUsers[0].id;
|
|
@@ -133,6 +133,18 @@ class Rest {
|
|
|
133
133
|
const response = await this.get('https://peoplehub.xboxlive.com/users/me/people/followers/decoration/detail,preferredColor,follower', { contractVersion: '5' });
|
|
134
134
|
return response.people;
|
|
135
135
|
}
|
|
136
|
+
async getFriendRequestsReceived() {
|
|
137
|
+
const response = await this.get('https://peoplehub.xboxlive.com/users/me/people/friendrequests(received)/decoration/detail,preferredColor,follower', { contractVersion: '7' });
|
|
138
|
+
return response.people;
|
|
139
|
+
}
|
|
140
|
+
async acceptFriendRequests(xuids) {
|
|
141
|
+
const response = await this.post('https://social.xboxlive.com/bulk/users/me/people/friends/v2?method=add', { data: { xuids }, contractVersion: '3' });
|
|
142
|
+
return response;
|
|
143
|
+
}
|
|
144
|
+
async declineFriendRequests(xuids) {
|
|
145
|
+
const response = await this.post('https://social.xboxlive.com/bulk/users/me/people/friends/v2?method=remove', { data: { xuids }, contractVersion: '3' });
|
|
146
|
+
return response;
|
|
147
|
+
}
|
|
136
148
|
async addXboxFriend(xuid) {
|
|
137
149
|
await this.put(`https://social.xboxlive.com/users/me/people/xuid(${xuid})`, { contractVersion: '2' });
|
|
138
150
|
}
|
|
@@ -20,8 +20,8 @@ export interface Person {
|
|
|
20
20
|
modernGamertag: string;
|
|
21
21
|
modernGamertagSuffix: string;
|
|
22
22
|
uniqueModernGamertag: string;
|
|
23
|
-
xboxOneRep:
|
|
24
|
-
presenceState:
|
|
23
|
+
xboxOneRep: string;
|
|
24
|
+
presenceState: string;
|
|
25
25
|
presenceText: string;
|
|
26
26
|
presenceDevices: null;
|
|
27
27
|
isBroadcasting: boolean;
|
|
@@ -37,7 +37,7 @@ export interface Person {
|
|
|
37
37
|
recentPlayer: null;
|
|
38
38
|
follower: Follower;
|
|
39
39
|
preferredColor: PreferredColor;
|
|
40
|
-
presenceDetails:
|
|
40
|
+
presenceDetails: null;
|
|
41
41
|
titlePresence: null;
|
|
42
42
|
titleSummaries: null;
|
|
43
43
|
presenceTitleIds: null;
|
|
@@ -89,19 +89,6 @@ export interface PreferredColor {
|
|
|
89
89
|
secondaryColor: string;
|
|
90
90
|
tertiaryColor: string;
|
|
91
91
|
}
|
|
92
|
-
export interface PresenceDetail {
|
|
93
|
-
IsBroadcasting: boolean;
|
|
94
|
-
Device: Device;
|
|
95
|
-
DeviceSubType: null;
|
|
96
|
-
GameplayType: null;
|
|
97
|
-
PresenceText: string;
|
|
98
|
-
State: State;
|
|
99
|
-
TitleId: string;
|
|
100
|
-
TitleType: null;
|
|
101
|
-
IsPrimary: boolean;
|
|
102
|
-
IsGame: boolean;
|
|
103
|
-
RichPresenceText: null | string;
|
|
104
|
-
}
|
|
105
92
|
export declare enum Device {
|
|
106
93
|
Android = "Android",
|
|
107
94
|
IOS = "iOS",
|
|
@@ -111,14 +98,85 @@ export declare enum Device {
|
|
|
111
98
|
WindowsOneCore = "WindowsOneCore",
|
|
112
99
|
XboxOne = "XboxOne"
|
|
113
100
|
}
|
|
114
|
-
export
|
|
115
|
-
|
|
116
|
-
|
|
101
|
+
export interface RESTPeoplehubGetFriendRequestResponse {
|
|
102
|
+
people: FriendRequestPerson[];
|
|
103
|
+
recommendationSummary: null;
|
|
104
|
+
friendFinderState: null;
|
|
105
|
+
accountLinkDetails: null;
|
|
106
|
+
friendRequestSummary: null;
|
|
117
107
|
}
|
|
118
|
-
export
|
|
119
|
-
|
|
120
|
-
|
|
108
|
+
export interface FriendRequestPerson {
|
|
109
|
+
detail: FriendRequestPersonDetail;
|
|
110
|
+
follower: Follower;
|
|
111
|
+
recommendation: null;
|
|
112
|
+
isFriend: boolean;
|
|
113
|
+
friendedDateTimeUtc: null;
|
|
114
|
+
isFriendRequestReceived: boolean;
|
|
115
|
+
isFriendRequestSent: boolean;
|
|
116
|
+
xuid: string;
|
|
117
|
+
appXuid: null;
|
|
118
|
+
isFavorite: boolean;
|
|
119
|
+
isFollowingCaller: boolean;
|
|
120
|
+
isFollowedByCaller: boolean;
|
|
121
|
+
isIdentityShared: boolean;
|
|
122
|
+
addedDateTimeUtc: string;
|
|
123
|
+
displayName: string;
|
|
124
|
+
realName: string;
|
|
125
|
+
displayPicRaw: string;
|
|
126
|
+
showUserAsAvatar: string;
|
|
127
|
+
gamertag: string;
|
|
128
|
+
gamerScore: string;
|
|
129
|
+
modernGamertag: string;
|
|
130
|
+
modernGamertagSuffix: string;
|
|
131
|
+
uniqueModernGamertag: string;
|
|
132
|
+
xboxOneRep: string;
|
|
133
|
+
presenceState: string;
|
|
134
|
+
presenceText: string;
|
|
135
|
+
presenceDevices: null;
|
|
136
|
+
isBroadcasting: boolean;
|
|
137
|
+
isCloaked: null;
|
|
138
|
+
isQuarantined: boolean;
|
|
139
|
+
isXbox360Gamerpic: boolean;
|
|
140
|
+
lastSeenDateTimeUtc: string;
|
|
141
|
+
suggestion: null;
|
|
142
|
+
search: null;
|
|
143
|
+
titleHistory: null;
|
|
144
|
+
multiplayerSummary: null;
|
|
145
|
+
recentPlayer: null;
|
|
146
|
+
preferredColor: PreferredColor;
|
|
147
|
+
presenceDetails: null;
|
|
148
|
+
titlePresence: null;
|
|
149
|
+
titleSummaries: null;
|
|
150
|
+
presenceTitleIds: null;
|
|
151
|
+
communityManagerTitles: null;
|
|
152
|
+
socialManager: null;
|
|
153
|
+
broadcast: null;
|
|
154
|
+
avatar: null;
|
|
155
|
+
linkedAccounts: LinkedAccount[];
|
|
156
|
+
colorTheme: string;
|
|
157
|
+
preferredFlag: string;
|
|
158
|
+
preferredPlatforms: string[];
|
|
121
159
|
}
|
|
122
|
-
export
|
|
123
|
-
|
|
160
|
+
export interface FriendRequestPersonDetail {
|
|
161
|
+
canBeFriended: boolean;
|
|
162
|
+
canBeFollowed: boolean;
|
|
163
|
+
isFriend: boolean;
|
|
164
|
+
friendCount: number;
|
|
165
|
+
isFriendRequestReceived: boolean;
|
|
166
|
+
isFriendRequestSent: boolean;
|
|
167
|
+
isFriendListShared: boolean;
|
|
168
|
+
isFollowingCaller: boolean;
|
|
169
|
+
isFollowedByCaller: boolean;
|
|
170
|
+
isFavorite: boolean;
|
|
171
|
+
accountTier: string;
|
|
172
|
+
bio: string;
|
|
173
|
+
isVerified: boolean;
|
|
174
|
+
location: string;
|
|
175
|
+
tenure: string;
|
|
176
|
+
watermarks: string[];
|
|
177
|
+
blocked: boolean;
|
|
178
|
+
mute: boolean;
|
|
179
|
+
followerCount: number;
|
|
180
|
+
followingCount: number;
|
|
181
|
+
hasGamePass: boolean;
|
|
124
182
|
}
|
package/dist/types/peoplehub.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Device = void 0;
|
|
4
4
|
var Device;
|
|
5
5
|
(function (Device) {
|
|
6
6
|
Device["Android"] = "Android";
|
|
@@ -11,17 +11,3 @@ var Device;
|
|
|
11
11
|
Device["WindowsOneCore"] = "WindowsOneCore";
|
|
12
12
|
Device["XboxOne"] = "XboxOne";
|
|
13
13
|
})(Device || (exports.Device = Device = {}));
|
|
14
|
-
var State;
|
|
15
|
-
(function (State) {
|
|
16
|
-
State["Active"] = "Active";
|
|
17
|
-
State["LastSeen"] = "LastSeen";
|
|
18
|
-
})(State || (exports.State = State = {}));
|
|
19
|
-
var PresenceState;
|
|
20
|
-
(function (PresenceState) {
|
|
21
|
-
PresenceState["Offline"] = "Offline";
|
|
22
|
-
PresenceState["Online"] = "Online";
|
|
23
|
-
})(PresenceState || (exports.PresenceState = PresenceState = {}));
|
|
24
|
-
var XboxOneRep;
|
|
25
|
-
(function (XboxOneRep) {
|
|
26
|
-
XboxOneRep["GoodPlayer"] = "GoodPlayer";
|
|
27
|
-
})(XboxOneRep || (exports.XboxOneRep = XboxOneRep = {}));
|
package/package.json
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "bedrock-portal",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Creates a joinable session in Minecraft Bedrock Edition that can route players to their a specified host",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"watch": "tsc --watch",
|
|
10
|
-
"lint": "eslint --ignore-path .gitignore .",
|
|
11
|
-
"fix": "eslint --fix --ignore-path .gitignore ."
|
|
12
|
-
},
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/LucienHH/bedrock-portal.git"
|
|
16
|
-
},
|
|
17
|
-
"author": "Lucienn",
|
|
18
|
-
"license": "ISC",
|
|
19
|
-
"bugs": {
|
|
20
|
-
"url": "https://github.com/LucienHH/bedrock-portal/issues"
|
|
21
|
-
},
|
|
22
|
-
"homepage": "https://github.com/LucienHH/bedrock-portal#readme",
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"axios": "^1.0.0",
|
|
25
|
-
"bedrock-portal-nethernet": "^1.0.
|
|
26
|
-
"debug": "^4.3.4",
|
|
27
|
-
"json-bigint": "^1.0.0",
|
|
28
|
-
"prismarine-auth": "github:LucienHH/prismarine-auth#playfab",
|
|
29
|
-
"tiny-typed-emitter": "^2.1.0",
|
|
30
|
-
"uuid": "^9.0.0",
|
|
31
|
-
"xbox-rta": "^2.0
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/debug": "^4.1.12",
|
|
35
|
-
"@types/json-bigint": "^1.0.4",
|
|
36
|
-
"@types/node": "^20.10.6",
|
|
37
|
-
"@types/uuid": "^9.0.8",
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^6.17.0",
|
|
39
|
-
"@typescript-eslint/parser": "^6.17.0",
|
|
40
|
-
"bedrock-portal": "file:.",
|
|
41
|
-
"eslint": "^8.33.0",
|
|
42
|
-
"typescript": "^5.3.3"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "bedrock-portal",
|
|
3
|
+
"version": "0.8.1",
|
|
4
|
+
"description": "Creates a joinable session in Minecraft Bedrock Edition that can route players to their a specified host",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"watch": "tsc --watch",
|
|
10
|
+
"lint": "eslint --ignore-path .gitignore .",
|
|
11
|
+
"fix": "eslint --fix --ignore-path .gitignore ."
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/LucienHH/bedrock-portal.git"
|
|
16
|
+
},
|
|
17
|
+
"author": "Lucienn",
|
|
18
|
+
"license": "ISC",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/LucienHH/bedrock-portal/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/LucienHH/bedrock-portal#readme",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"axios": "^1.0.0",
|
|
25
|
+
"bedrock-portal-nethernet": "^1.0.6",
|
|
26
|
+
"debug": "^4.3.4",
|
|
27
|
+
"json-bigint": "^1.0.0",
|
|
28
|
+
"prismarine-auth": "github:LucienHH/prismarine-auth#playfab",
|
|
29
|
+
"tiny-typed-emitter": "^2.1.0",
|
|
30
|
+
"uuid": "^9.0.0",
|
|
31
|
+
"xbox-rta": "^2.1.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/debug": "^4.1.12",
|
|
35
|
+
"@types/json-bigint": "^1.0.4",
|
|
36
|
+
"@types/node": "^20.10.6",
|
|
37
|
+
"@types/uuid": "^9.0.8",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^6.17.0",
|
|
39
|
+
"@typescript-eslint/parser": "^6.17.0",
|
|
40
|
+
"bedrock-portal": "file:.",
|
|
41
|
+
"eslint": "^8.33.0",
|
|
42
|
+
"typescript": "^5.3.3"
|
|
43
|
+
}
|
|
44
|
+
}
|