Skip to content

Commit

Permalink
refactor: Move bot check earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
Sup3rFire committed Apr 13, 2024
1 parent 0ce7df5 commit 2a219fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export default class Client extends EventEmitter {
key: "users_me_" + token,
});

if (me.user.role !== "bot")
throw new Error(
`Client "${me.user.username}" is not a bot account. Contact TETR.IO Support (https://tetr.io/about/support/) to apply for a bot account.`
);

this.me = new ClientUser(this.ws, me, await this.fetchUser(me.user._id));

await this.ws.connect();
Expand Down
5 changes: 0 additions & 5 deletions src/client/ClientUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ export default class ClientUser extends EventEmitter {

this.ws = ws;

if (me.role !== "bot")
throw new Error(
`Client "${me.username}" is not a bot account. Contact TETR.IO Support (https://tetr.io/about/support/) to apply for a bot account.`
);

this.user = user;
this.email = me.email;
this.privacy = {
Expand Down

0 comments on commit 2a219fc

Please sign in to comment.