bedrock-portal 0.7.0 → 0.8.0

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 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,248 @@
1
- # BedrockPortal
2
- [![NPM version](https://img.shields.io/npm/v/bedrock-portal.svg)](http://npmjs.com/package/bedrock-portal)
3
- [![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](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
- ### InviteOnMessage
171
-
172
- Automatically invites players to the game when they send a message in the chat. `#.use(Modules.inviteOnMessage);`
173
-
174
- Options:
175
- - **command**: string - The command to use to invite players (default: 'invite')
176
- - **checkInterval**: number - How often to check for messages (default: 30000ms)
177
-
178
- ```js
179
- const { BedrockPortal, Modules } = require('bedrock-portal');
180
-
181
- const portal = new BedrockPortal(auth, { ... })
182
-
183
- portal.use(Modules.InviteOnMessage);
184
-
185
- // or
186
-
187
- portal.use(Modules.InviteOnMessage, {
188
- // The command to use to invite players (optional - defaults to 'invite')
189
- command: 'invite',
190
- // How often to check for messages (optional - defaults to 30000ms)
191
- checkInterval: 30000,
192
- });
193
- ```
194
-
195
- ## Modules API
196
-
197
- Creating a module is easy. You can create a module by extending the `Module` class.
198
-
199
- 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.
200
-
201
- ```js
202
- const { Module } = require('bedrock-portal');
203
-
204
- const myModule = class MyModule extends Module {
205
- constructor() {
206
- super('myModule', 'Description of my module');
207
- this.options = {
208
- option1: true,
209
- }
210
- }
211
-
212
- async run(portal) {
213
- // portal - The BedrockPortal instance
214
-
215
- // Do stuff here
216
- }
217
-
218
- async stop() {
219
- super.stop();
220
- // Do stuff when the module is stopped
221
- }
222
- }
223
-
224
- portal.use(myModule, {
225
- option1: false,
226
- });
227
-
228
- ```
229
-
230
- ## Events
231
-
232
- ### portal.on('sessionCreated', (session) => void)
233
- Emitted when a session is created.
234
-
235
- ### portal.on('sessionUpdated', (session) => void)
236
- Emitted when a session is updated.
237
-
238
- ### portal.on('playerJoin', (player) => void)
239
- Emitted when a player joins the session.
240
-
241
- ### portal.on('playerLeave', (player) => void)
242
- Emitted when a player leaves the session.
243
-
244
-
245
- ### portal.on('friendAdded', (player) => void)
246
- Emitted when a player is added as a friend. This event is only emitted when the `autoFriendAdd` module is enabled.
247
-
248
- ### portal.on('friendRemoved', (player) => void)
249
- Emitted when a player is removed as a friend. This event is only emitted when the `autoFriendAdd` module is enabled.
250
-
251
- ### portal.on('messageRecieved', (message) => void)
252
- Emitted when a message is recieved from a player. This event is only emitted when the `inviteOnMessage` module is enabled.
253
-
254
- ## Debugging
255
-
256
- 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.
257
-
258
- ## License
259
-
260
- [MIT](LICENSE)
1
+ # BedrockPortal
2
+ [![NPM version](https://img.shields.io/npm/v/bedrock-portal.svg)](http://npmjs.com/package/bedrock-portal)
3
+ [![Discord](https://img.shields.io/badge/chat-on%20discord-brightgreen.svg)](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 accepts friend requests sent to the account. `#.use(Modules.autoFriendAdd);`
139
+
140
+ Options:
141
+ - **inviteOnAdd**: boolean - Automatically invites added friends to the game (default: false)
142
+ - **conditionToMeet**: (player: Player) => boolean - If the function returns true then the request will be accepted (default: () => true)
143
+
144
+ ```js
145
+ const { BedrockPortal, Modules } = require('bedrock-portal');
146
+
147
+ const portal = new BedrockPortal(auth, { ... })
148
+
149
+ portal.use(Modules.AutoFriendAdd);
150
+
151
+ // or
152
+
153
+ portal.use(Modules.AutoFriendAdd, {
154
+ // When a friend is added invite them to the game
155
+ inviteOnAdd: true,
156
+ // Only accept friends that have 'elite' in their gamertag
157
+ conditionToMeet: (player) => player.gamertag.includes('elite'),
158
+ });
159
+ ```
160
+
161
+ ### InviteOnMessage
162
+
163
+ Automatically invites players to the game when they send a message in the chat. `#.use(Modules.inviteOnMessage);`
164
+
165
+ Options:
166
+ - **command**: string - The command to use to invite players (default: 'invite')
167
+ - **checkInterval**: number - How often to check for messages (default: 30000ms)
168
+
169
+ ```js
170
+ const { BedrockPortal, Modules } = require('bedrock-portal');
171
+
172
+ const portal = new BedrockPortal(auth, { ... })
173
+
174
+ portal.use(Modules.InviteOnMessage);
175
+
176
+ // or
177
+
178
+ portal.use(Modules.InviteOnMessage, {
179
+ // The command to use to invite players (optional - defaults to 'invite')
180
+ command: 'invite',
181
+ // How often to check for messages (optional - defaults to 30000ms)
182
+ checkInterval: 30000,
183
+ });
184
+ ```
185
+
186
+ ## Modules API
187
+
188
+ Creating a module is easy. You can create a module by extending the `Module` class.
189
+
190
+ 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.
191
+
192
+ ```js
193
+ const { Module } = require('bedrock-portal');
194
+
195
+ const myModule = class MyModule extends Module {
196
+ constructor() {
197
+ super('myModule', 'Description of my module');
198
+ this.options = {
199
+ option1: true,
200
+ }
201
+ }
202
+
203
+ async run(portal) {
204
+ // portal - The BedrockPortal instance
205
+
206
+ // Do stuff here
207
+ }
208
+
209
+ async stop() {
210
+ super.stop();
211
+ // Do stuff when the module is stopped
212
+ }
213
+ }
214
+
215
+ portal.use(myModule, {
216
+ option1: false,
217
+ });
218
+
219
+ ```
220
+
221
+ ## Events
222
+
223
+ ### portal.on('sessionCreated', (session) => void)
224
+ Emitted when a session is created.
225
+
226
+ ### portal.on('sessionUpdated', (session) => void)
227
+ Emitted when a session is updated.
228
+
229
+ ### portal.on('playerJoin', (player) => void)
230
+ Emitted when a player joins the session.
231
+
232
+ ### portal.on('playerLeave', (player) => void)
233
+ Emitted when a player leaves the session.
234
+
235
+
236
+ ### portal.on('friendAdded', (player) => void)
237
+ Emitted when a player is added as a friend. This event is only emitted when the `autoFriendAdd` module is enabled.
238
+
239
+ ### portal.on('messageRecieved', (message) => void)
240
+ Emitted when a message is recieved from a player. This event is only emitted when the `inviteOnMessage` module is enabled.
241
+
242
+ ## Debugging
243
+
244
+ 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.
245
+
246
+ ## License
247
+
248
+ [MIT](LICENSE)
@@ -9,11 +9,14 @@ const xbox_rta_1 = require("xbox-rta");
9
9
  const rest_1 = __importDefault(require("../rest"));
10
10
  const debug = (0, debug_1.default)('bedrock-portal');
11
11
  class Host {
12
+ portal;
13
+ authflow;
14
+ rest;
15
+ rta = null;
16
+ profile = null;
17
+ connectionId = null;
18
+ subscriptionId = (0, uuid_1.v4)();
12
19
  constructor(portal, authflow) {
13
- this.rta = null;
14
- this.profile = null;
15
- this.connectionId = null;
16
- this.subscriptionId = (0, uuid_1.v4)();
17
20
  this.portal = portal;
18
21
  this.authflow = authflow;
19
22
  this.rest = new rest_1.default(this.authflow);
@@ -21,7 +24,6 @@ class Host {
21
24
  async connect() {
22
25
  const auth = await this.authflow.getXboxToken();
23
26
  this.profile = await this.rest.getProfile(auth.userXUID);
24
- // @ts-expect-error - XboxRTA isnt using the #playfab branch
25
27
  this.rta = new xbox_rta_1.XboxRTA(this.authflow);
26
28
  await this.rta.connect();
27
29
  const subResponse = await this.rta.subscribe('https://sessiondirectory.xboxlive.com/connections/');
@@ -29,9 +31,9 @@ class Host {
29
31
  this.rta.on('subscribe', (event) => this.onSubscribe(event));
30
32
  }
31
33
  async onSubscribe(event) {
32
- debug('Received RTA subscribe event', event);
33
- const connectionId = event.data.ConnectionId;
34
+ const connectionId = event.data?.ConnectionId;
34
35
  if (connectionId && typeof connectionId === 'string') {
36
+ debug('Received RTA subscribe event', event);
35
37
  try {
36
38
  this.connectionId = connectionId;
37
39
  await this.rest.updateConnection(this.portal.session.name, connectionId);
@@ -5,6 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const debug_1 = __importDefault(require("debug"));
7
7
  class Module {
8
+ name;
9
+ description;
10
+ stopped;
11
+ options;
12
+ debug;
8
13
  constructor(name, description) {
9
14
  this.name = name;
10
15
  this.description = description;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class Player {
4
+ profile;
5
+ session;
4
6
  constructor(profileData, sessionData) {
5
7
  this.profile = {};
6
8
  this.session = {};
@@ -0,0 +1,2 @@
1
+ export declare const isXuid: (xuid: string) => boolean;
2
+ export declare const getRandomUint64: () => bigint;
@@ -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;
@@ -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.js CHANGED
@@ -7,6 +7,7 @@ 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;
@@ -17,31 +18,27 @@ 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"));
19
20
  const start_game_1 = require("./common/start_game");
20
- // @ts-expect-error - index.d.ts isn't updated
21
- const bedrock_protocol_1 = require("@lucienhh/bedrock-protocol");
21
+ const util_1 = require("./common/util");
22
22
  const debug = (0, debug_1.default)('bedrock-portal');
23
- const getRandomUint64 = () => {
24
- // Generate two 32-bit random integers
25
- const high = Math.floor(Math.random() * 0xFFFFFFFF);
26
- const low = Math.floor(Math.random() * 0xFFFFFFFF);
27
- // Combine them to create a 64-bit unsigned integer
28
- const result = (BigInt(high) << 32n) | BigInt(low);
29
- return result;
30
- };
31
23
  class BedrockPortal extends tiny_typed_emitter_1.TypedEmitter {
24
+ authflow;
25
+ host;
26
+ options;
27
+ session;
28
+ players;
29
+ modules = new Map();
32
30
  constructor(authflow, options) {
33
31
  super();
34
- this.modules = new Map();
35
32
  this.options = {
36
33
  ip: '',
37
34
  port: 19132,
38
35
  joinability: constants_1.Joinability.FriendsOfFriends,
39
- webRTCNetworkId: getRandomUint64(),
36
+ webRTCNetworkId: (0, util_1.getRandomUint64)(),
40
37
  ...options,
41
38
  world: {
42
39
  hostName: 'Bedrock Portal v0.6.0',
43
40
  name: 'By LucienHH',
44
- version: '0.6.0',
41
+ version: '0.7.1',
45
42
  memberCount: 0,
46
43
  maxMemberCount: 10,
47
44
  ...options.world,
@@ -69,36 +66,18 @@ class BedrockPortal extends tiny_typed_emitter_1.TypedEmitter {
69
66
  this.players = new Map();
70
67
  await this.host.connect();
71
68
  this.session.name = (0, uuid_1.v4)();
72
- const server = new bedrock_protocol_1.Server({
69
+ const server = new bedrock_portal_nethernet_1.Server({
73
70
  version: '1.21.20', // The server version
74
71
  compressionAlgorithm: 'none',
75
72
  });
76
- server.listenNethernet(this.authflow, this.options.webRTCNetworkId);
77
- server.on('connect', (client) => {
73
+ server.listen(this.authflow, this.options.webRTCNetworkId);
74
+ server.on('connect', client => {
78
75
  client.on('join', () => {
79
76
  console.log(`Client ${client.id} has joined the server.`);
80
- client.write('resource_packs_info', {
81
- must_accept: false,
82
- has_scripts: false,
83
- behaviour_packs: [],
84
- texture_packs: [],
85
- resource_pack_links: [],
86
- });
87
- client.write('resource_pack_stack', {
88
- must_accept: false,
89
- behavior_packs: [],
90
- resource_packs: [],
91
- game_version: '',
92
- experiments: [],
93
- experiments_previously_used: false,
94
- });
95
- client.once('resource_pack_client_response', async (rp) => {
96
- client.write('start_game', start_game_1.start_game);
97
- });
98
- // TODO: Tie this to an event
99
- setTimeout(() => {
77
+ client.write('start_game', start_game_1.start_game);
78
+ client.once('set_player_game_type', () => {
100
79
  client.write('transfer', { server_address: this.options.ip, port: this.options.port });
101
- }, 6000);
80
+ });
102
81
  });
103
82
  });
104
83
  const session = await this.createAndPublishSession();
@@ -144,11 +123,13 @@ class BedrockPortal extends tiny_typed_emitter_1.TypedEmitter {
144
123
  */
145
124
  async invitePlayer(identifier) {
146
125
  debug(`Inviting player, identifier: ${identifier}`);
147
- const profile = await this.host.rest.getProfile(identifier)
148
- .catch(() => { throw new Error(`Failed to get profile for identifier: ${identifier}`); });
149
- debug(`Inviting player, Got profile, xuid: ${profile.xuid}`);
150
- await this.host.rest.sendInvite(this.session.name, profile.xuid);
151
- debug(`Invited player, xuid: ${profile.xuid}`);
126
+ if (!(0, util_1.isXuid)(identifier)) {
127
+ const profile = await this.host.rest.getProfile(identifier)
128
+ .catch(() => { throw new Error(`Failed to get profile for identifier: ${identifier}`); });
129
+ identifier = profile.xuid;
130
+ }
131
+ await this.host.rest.sendInvite(this.session.name, identifier);
132
+ debug(`Invited player, xuid: ${identifier}`);
152
133
  }
153
134
  /**
154
135
  * Updates the current member count which is displayed in the Minecraft client.
@@ -192,11 +173,11 @@ class BedrockPortal extends tiny_typed_emitter_1.TypedEmitter {
192
173
  }
193
174
  async createAndPublishSession() {
194
175
  await this.updateSession(this.createSessionBody());
195
- debug(`Created session, name: ${this.session.name}`);
176
+ debug(`Created session, name: ${this.session.name}, ID: ${this.options.webRTCNetworkId}`);
196
177
  await this.host.rest.setActivity(this.session.name);
197
178
  const session = await this.getSession();
198
179
  await this.updateSession({ properties: session.properties });
199
- debug(`Published session, name: ${this.session.name}`);
180
+ debug(`Published session, name: ${this.session.name}, ID: ${this.options.webRTCNetworkId}`);
200
181
  return session;
201
182
  }
202
183
  createSessionBody() {
@@ -1,7 +1,6 @@
1
1
  import type { BedrockPortal } from '../index';
2
2
  import Module from '../classes/Module';
3
3
  export default class AutoFriendAdd extends Module {
4
- interval: NodeJS.Timeout | null;
5
4
  constructor();
6
5
  run(portal: BedrockPortal): Promise<void>;
7
6
  stop(): Promise<void>;
@@ -3,75 +3,52 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const promises_1 = require("timers/promises");
7
6
  const Module_1 = __importDefault(require("../classes/Module"));
8
7
  const Player_1 = __importDefault(require("../classes/Player"));
9
8
  const multipleAccounts_1 = __importDefault(require("./multipleAccounts"));
10
9
  class AutoFriendAdd extends Module_1.default {
11
10
  constructor() {
12
- super('autoFriendAdd', 'Automatically adds followers as friends');
13
- this.interval = null;
11
+ super('autoFriendAdd', 'Automatically accept friend requests');
14
12
  this.options = {
15
13
  inviteOnAdd: false,
16
14
  conditionToMeet: () => true,
17
- checkInterval: 30000,
18
- addInterval: 2000,
19
- removeInterval: 2000,
20
15
  };
21
16
  }
22
17
  async run(portal) {
23
18
  const addXboxFriend = async (host) => {
24
- this.debug('Checking for followers to add');
25
- const followers = await host.rest.getXboxFollowers()
26
- .catch(() => []);
27
- this.debug(`Found ${followers.length} follower(s)`);
28
- const needsAdding = followers.filter(res => !res.isFollowedByCaller && this.options.conditionToMeet(res));
29
- this.debug(`Adding ${needsAdding.length} account(s) [${needsAdding.map(res => res.gamertag).join(', ')}]`);
30
- for (const account of needsAdding) {
31
- await host.rest.addXboxFriend(account.xuid).catch(() => {
32
- throw Error(`Failed to add ${account.gamertag}`);
33
- });
34
- if (this.options.inviteOnAdd) {
35
- await portal.invitePlayer(account.xuid).catch(() => {
36
- throw Error(`Failed to invite ${account.gamertag}`);
37
- });
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
+ }
38
36
  }
39
- portal.emit('friendAdded', new Player_1.default(account, null));
40
- this.debug(`Added & invited ${account.gamertag}`);
41
- await (0, promises_1.setTimeout)(this.options.addInterval);
42
- }
43
- this.debug('Checking for friends to remove');
44
- const friends = await host.rest.getXboxFriends()
45
- .catch(() => []);
46
- this.debug(`Found ${friends.length} friend(s)`);
47
- const needsRemoving = friends.filter(res => !res.isFollowingCaller || !this.options.conditionToMeet(res));
48
- this.debug(`Removing ${needsRemoving.length} account(s) [${needsRemoving.map(res => res.gamertag).join(', ')}]`);
49
- for (const account of needsRemoving) {
50
- await host.rest.removeXboxFriend(account.xuid).catch(() => {
51
- throw Error(`Failed to remove ${account.gamertag}`);
52
- });
53
- portal.emit('friendRemoved', new Player_1.default(account, null));
54
- this.debug(`Removed ${account.gamertag}`);
55
- await (0, promises_1.setTimeout)(this.options.removeInterval);
56
- }
37
+ });
38
+ await host.rta?.subscribe(`https://social.xboxlive.com/users/xuid(${host.profile?.xuid})/friends`);
57
39
  };
58
- this.interval = setInterval(() => {
59
- const multipleAccounts = portal.modules.get('multipleAccounts');
60
- if (multipleAccounts && multipleAccounts instanceof multipleAccounts_1.default) {
61
- for (const account of multipleAccounts.peers.values()) {
62
- addXboxFriend(account)
63
- .catch(error => this.debug(`Error: ${error.message}`, error));
64
- }
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));
65
45
  }
66
- addXboxFriend(portal.host)
67
- .catch(error => this.debug(`Error: ${error.message}`, error));
68
- }, this.options.checkInterval);
46
+ }
47
+ addXboxFriend(portal.host)
48
+ .catch(error => this.debug(`Error: ${error.message}`, error));
69
49
  }
70
50
  async stop() {
71
51
  super.stop();
72
- if (this.interval) {
73
- clearInterval(this.interval);
74
- }
75
52
  }
76
53
  }
77
54
  exports.default = AutoFriendAdd;
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Module_1 = __importDefault(require("../classes/Module"));
7
7
  class IniteOnMessage extends Module_1.default {
8
+ interval = null;
9
+ cache;
8
10
  constructor() {
9
11
  super('initeOnMessage', 'Automatically invite players to the server when they message you');
10
- this.interval = null;
11
12
  this.options = {
12
13
  command: 'invite',
13
14
  checkInterval: 30000,
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Module_1 = __importDefault(require("../classes/Module"));
7
7
  const Host_1 = __importDefault(require("../classes/Host"));
8
8
  class MultipleAccounts extends Module_1.default {
9
+ options;
10
+ peers;
9
11
  constructor() {
10
12
  super('multipleAccounts', 'Make the portal session joinable from multiple accounts');
11
13
  this.options = {
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Module_1 = __importDefault(require("../classes/Module"));
7
7
  const cd = new Set();
8
8
  class RedirectFromRealm extends Module_1.default {
9
+ bedrock;
10
+ client;
11
+ heartbeat = null;
9
12
  constructor() {
10
13
  super('redirectFromRealm', 'Automatically invite players to the server when they join a Realm');
11
- this.heartbeat = null;
12
14
  this.options = {
13
15
  clientOptions: {}, // Options for the bedrock-protocol client
14
16
  chatCommand: {
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,7 +6,10 @@ 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 {
11
+ auth;
12
+ options;
10
13
  constructor(authflow, options = {}) {
11
14
  this.auth = authflow;
12
15
  this.options = options;
@@ -44,8 +47,8 @@ class Rest {
44
47
  payload.data = config.data;
45
48
  return (0, axios_1.default)({
46
49
  ...payload,
47
- transformResponse: [data => (0, json_bigint_1.parse)(data)],
48
- transformRequest: [data => (0, json_bigint_1.stringify)(data)],
50
+ transformResponse: [data => data ? (0, json_bigint_1.parse)(data) : undefined],
51
+ transformRequest: [data => data ? (0, json_bigint_1.stringify)(data) : undefined],
49
52
  }).then(e => e.data);
50
53
  }
51
54
  async sendHandle(payload) {
@@ -110,8 +113,7 @@ class Rest {
110
113
  }
111
114
  async getProfile(input) {
112
115
  let xuid = input;
113
- const isXuid = /^\d{16}$/.test(input);
114
- if (!isXuid) {
116
+ if (!(0, util_1.isXuid)(input)) {
115
117
  const target = input === 'me' ? 'me' : `gt(${encodeURIComponent(input)})`;
116
118
  const response = await this.get(`https://profile.xboxlive.com/users/${target}/settings`, { contractVersion: '2' });
117
119
  xuid = response.profileUsers[0].id;
@@ -131,6 +133,18 @@ class Rest {
131
133
  const response = await this.get('https://peoplehub.xboxlive.com/users/me/people/followers/decoration/detail,preferredColor,follower', { contractVersion: '5' });
132
134
  return response.people;
133
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
+ }
134
148
  async addXboxFriend(xuid) {
135
149
  await this.put(`https://social.xboxlive.com/users/me/people/xuid(${xuid})`, { contractVersion: '2' });
136
150
  }
@@ -20,8 +20,8 @@ export interface Person {
20
20
  modernGamertag: string;
21
21
  modernGamertagSuffix: string;
22
22
  uniqueModernGamertag: string;
23
- xboxOneRep: XboxOneRep;
24
- presenceState: 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: PresenceDetail[];
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 declare enum State {
115
- Active = "Active",
116
- LastSeen = "LastSeen"
101
+ export interface RESTPeoplehubGetFriendRequestResponse {
102
+ people: FriendRequestPerson[];
103
+ recommendationSummary: null;
104
+ friendFinderState: null;
105
+ accountLinkDetails: null;
106
+ friendRequestSummary: null;
117
107
  }
118
- export declare enum PresenceState {
119
- Offline = "Offline",
120
- Online = "Online"
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 declare enum XboxOneRep {
123
- GoodPlayer = "GoodPlayer"
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
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.XboxOneRep = exports.PresenceState = exports.State = exports.Device = void 0;
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 = {}));
@@ -0,0 +1,4 @@
1
+ export interface RESTSocialPostBulkFriendRequestResponse {
2
+ updatedPeople: string[];
3
+ failedToUpdate: string[];
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,44 +1,44 @@
1
- {
2
- "name": "bedrock-portal",
3
- "version": "0.7.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
- "@lucienhh/bedrock-protocol": "^3.39.0",
25
- "axios": "^1.0.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.1"
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.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.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
+ }