yolkbot 0.1.2-alpha.20 → 0.1.2-alpha.22

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "yolkbot",
3
3
  "description": "create a shell shockers bot in under 10 lines.",
4
- "version": "0.1.2-alpha.20",
4
+ "version": "0.1.2-alpha.22",
5
5
  "keywords": [
6
6
  "shell shockers",
7
7
  "shellshock.io",
package/src/bot.js CHANGED
@@ -398,7 +398,7 @@ export class Bot {
398
398
  async createPrivateGame(opts = {}) {
399
399
  if (!await this.initMatchmaker()) return false;
400
400
 
401
- if (!opts.region) { throw new Error('pass a region: createPrivateGame({ region: "useast", ... })') }
401
+ if (!opts.region) throw new Error('pass a region: createPrivateGame({ region: "useast", ... })')
402
402
  if (!this.matchmaker.regionList.find(r => r.id == opts.region))
403
403
  throw new Error('invalid region, see <bot>.matchmaker.regionList for a region list (pass an "id")')
404
404
 
@@ -1724,7 +1724,7 @@ export class Bot {
1724
1724
  if (typeof response === 'string') return response;
1725
1725
 
1726
1726
  this.account.cw.limit = response.limit;
1727
- this.account.cw.atLimit = response.limit >= 5;
1727
+ this.account.cw.atLimit = response.limit >= 4;
1728
1728
 
1729
1729
  // if there is a "span", that means that it's under the daily limit and you can play again soon
1730
1730
  // if there is a "period", that means that the account is done for the day and must wait a long time
@@ -1918,8 +1918,8 @@ export class Bot {
1918
1918
 
1919
1919
  clearInterval(this.updateIntervalId);
1920
1920
 
1921
- if (this.game) this.game.socket.close();
1922
- this.matchmaker.close();
1921
+ if (this.game.socket) this.game.socket.close();
1922
+ if (this.matchmaker) this.matchmaker.close();
1923
1923
 
1924
1924
  if (!finishDispatches) this._dispatches = [];
1925
1925
  this._packetQueue = [];
package/src/matchmaker.js CHANGED
@@ -103,7 +103,7 @@ export class Matchmaker {
103
103
  this.on('msg', listener);
104
104
 
105
105
  this.ws.onerror = (e2) => {
106
- throw new Error('Failed to get regions', e2);
106
+ throw new Error('failed to get regions', e2);
107
107
  }
108
108
 
109
109
  this.ws.send(JSON.stringify({ command: 'regionList' }));
@@ -116,17 +116,15 @@ export class Matchmaker {
116
116
  // params.region
117
117
  // params.mode -> params.gameType
118
118
  // params.isPublic -> params.playType
119
- if (!params.region) { throw new Error('did not specify a region in findGame, use <Matchmaker>.getRegions() for a list') }
119
+ if (!params.region) throw new Error('did not specify a region in findGame, use <Matchmaker>.getRegions() for a list')
120
120
 
121
121
  if (this.regionList) {
122
122
  const region = this.regionList.find(r => r.id == params.region);
123
- if (!region) {
124
- throw new Error('did not find region in regionList, if you are attempting to force a region, avoid calling getRegions()')
125
- }
123
+ if (!region) throw new Error('did not find region in regionList, if you are attempting to force a region, avoid calling getRegions()')
126
124
  } // else { console.log('regionList not found, not validating findGame region, use <Matchmaker>.regionList() to check region') }
127
125
 
128
- if (!params.mode) { throw new Error('did not specify a mode in findGame') }
129
- if (GameModes[params.mode] === undefined) { throw new Error('invalid mode in findGame, see GameModes for a list') }
126
+ if (!params.mode) throw new Error('did not specify a mode in findGame')
127
+ if (GameModes[params.mode] === undefined) throw new Error('invalid mode in findGame, see GameModes for a list')
130
128
 
131
129
  return new Promise((res) => {
132
130
  const opts = {
@@ -16,6 +16,7 @@ export interface QueryResponse {
16
16
  }
17
17
 
18
18
  export function queryServices(request: QueryRequest, proxy?: string, instance?: string): Promise<QueryResponse | string>;
19
- export function loginWithCredentials(email: string, password: string, prox?: string, instance?: string): Promise<QueryResponse | string>;
20
- export function loginWithRefreshToken(refreshToken: string, prox?: string, instance?: string): Promise<QueryResponse | string>;
21
- export function loginAnonymously(prox?: string, instance?: string): Promise<QueryResponse | string>;
19
+ export function loginWithCredentials(email: string, password: string, proxy?: string, instance?: string): Promise<QueryResponse | string>;
20
+ export function loginWithRefreshToken(refreshToken: string, proxy?: string, instance?: string): Promise<QueryResponse | string>;
21
+ export function loginAnonymously(proxy?: string, instance?: string): Promise<QueryResponse | string>;
22
+ export function createAccount(email: string, password: string, proxy?: string, instance?: string): Promise<QueryResponse | string>;