diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sd.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/sd.js b/lib/sd.js index c0b14df..ea3fba9 100644 --- a/lib/sd.js +++ b/lib/sd.js @@ -52,6 +52,8 @@ export default class SoktDeer { }) }) } + + //TODO - implement this loginToken(token) { return new Promise((resolve, reject) => { this.ws.send(JSON.stringify({ @@ -65,6 +67,19 @@ export default class SoktDeer { }) } + getUser(username) { + return new Promise((resolve, reject) => { + this.ws.send(JSON.stringify({ + command: "get_user", + username + })) + this.wsEvents.once('user', resp => { + if (resp.error) reject(resp.code) + else resolve(resp.user) + }) + }) + } + ping() { this.ws.send(JSON.stringify({ command: "ping" })) } |