mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
initial
This commit is contained in:
34
src/client/Client.js
Normal file
34
src/client/Client.js
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
const EventEmitter = require('events').EventEmitter;
|
||||
const MergeDefault = require('../util/MergeDefault');
|
||||
const Constants = require('../util/Constants');
|
||||
const RESTManager = require('./rest/RestManager');
|
||||
const ClientDataStore = require('../structures/DataStore/ClientDataStore');
|
||||
const ClientManager = require('./ClientManager');
|
||||
const WebSocketManager = require('./websocket/WebSocketManager');
|
||||
|
||||
class Client extends EventEmitter{
|
||||
|
||||
constructor(options) {
|
||||
super();
|
||||
this.options = MergeDefault(Constants.DefaultOptions, options);
|
||||
this.rest = new RESTManager(this);
|
||||
this.store = new ClientDataStore(this);
|
||||
this.manager = new ClientManager(this);
|
||||
this.ws = new WebSocketManager(this);
|
||||
}
|
||||
|
||||
login(email, password) {
|
||||
if (password) {
|
||||
// login with email and password
|
||||
return this.rest.methods.LoginEmailPassword(email, password);
|
||||
} else {
|
||||
// login with token
|
||||
return this.rest.methods.LoginToken(email);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
Reference in New Issue
Block a user