mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +01:00
More docs
This commit is contained in:
@@ -341,3 +341,78 @@ Sets the name and topic of a channel
|
|||||||
- **callback** - `function` taking the following:
|
- **callback** - `function` taking the following:
|
||||||
|
|
||||||
- **error** - error if any occurred
|
- **error** - error if any occurred
|
||||||
|
|
||||||
|
startTyping(channel, `callback`)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Marks the client as typing in a channel.
|
||||||
|
|
||||||
|
- **channel** - A `Channel Resolvable`_
|
||||||
|
- **callback** - `function` taking the following:
|
||||||
|
|
||||||
|
- **error** - error if any occurred
|
||||||
|
|
||||||
|
stopTyping(channel, `callback`)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Marks the client as not typing in a channel (takes a few seconds to go active).
|
||||||
|
|
||||||
|
- **channel** - A `Channel Resolvable`_
|
||||||
|
- **callback** - `function` taking the following:
|
||||||
|
|
||||||
|
- **error** - error if any occurred
|
||||||
|
|
||||||
|
updateDetails(details, `callback`)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Updates the details of the client
|
||||||
|
|
||||||
|
- **details** - `object` containing any of the following:
|
||||||
|
|
||||||
|
- **avatar** - `Base64 Resolvable`_, new avatar of the client
|
||||||
|
- **email** - `String`, new email of the client
|
||||||
|
- **newPassword** - `String`, new password of the client
|
||||||
|
- **username** - `String`, new username of the client
|
||||||
|
- **callback** - `function` taking the following:
|
||||||
|
|
||||||
|
- **error** - error if any occurred
|
||||||
|
|
||||||
|
setAvatar(avatar, `callback`)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Sets the avatar of the client
|
||||||
|
|
||||||
|
- **avatar** - `Base64 Resolvable`_, new avatar of the client
|
||||||
|
- **callback** - `function` taking the following:
|
||||||
|
|
||||||
|
- **error** - error if any occurred
|
||||||
|
|
||||||
|
setUsername(name, `callback`)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Sets the username of the client
|
||||||
|
|
||||||
|
- **username** - `String`, new username of the Client
|
||||||
|
- **callback** - `function` taking the following:
|
||||||
|
|
||||||
|
- **error** - error if any occurred
|
||||||
|
|
||||||
|
joinVoiceChannel(channel, `callback`)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Joins a Voice Channel to begin transmitting audio
|
||||||
|
|
||||||
|
- **channel** - A `VoiceChannel Resolvable`_
|
||||||
|
- **callback** - `function` that takes the following:
|
||||||
|
|
||||||
|
- **error** - error if any occurred
|
||||||
|
- **connection** - VoiceConnection_, the created Voice Connection.
|
||||||
|
|
||||||
|
leaveVoiceChannel(`callback`)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Leaves the currently connected Voice Channel if connected
|
||||||
|
|
||||||
|
- **callback** - `function` that takes the following:
|
||||||
|
|
||||||
|
- **error** - error if any occurred
|
||||||
|
|||||||
@@ -591,13 +591,13 @@ var Client = (function (_EventEmitter) {
|
|||||||
|
|
||||||
//def setChannelName
|
//def setChannelName
|
||||||
|
|
||||||
Client.prototype.setChannelName = function setChannelName(channel, topic) {
|
Client.prototype.setChannelName = function setChannelName(channel, name) {
|
||||||
var callback = arguments.length <= 2 || arguments[2] === undefined ? function (err) {} : arguments[2];
|
var callback = arguments.length <= 2 || arguments[2] === undefined ? function (err) {} : arguments[2];
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
self.internal.setChannelName(channel, topic).then(function () {
|
self.internal.setChannelName(channel, name).then(function () {
|
||||||
callback();
|
callback();
|
||||||
resolve();
|
resolve();
|
||||||
})["catch"](function (e) {
|
})["catch"](function (e) {
|
||||||
@@ -748,6 +748,23 @@ var Client = (function (_EventEmitter) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// def leaveVoiceChannel
|
||||||
|
|
||||||
|
Client.prototype.leaveVoiceChannel = function leaveVoiceChannel() {
|
||||||
|
var callback = arguments.length <= 0 || arguments[0] === undefined ? function (err) {} : arguments[0];
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
self.internal.leaveVoiceChannel().then(function () {
|
||||||
|
callback();
|
||||||
|
resolve();
|
||||||
|
})["catch"](function (err) {
|
||||||
|
callback(err);
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
_createClass(Client, [{
|
_createClass(Client, [{
|
||||||
key: "users",
|
key: "users",
|
||||||
get: function get() {
|
get: function get() {
|
||||||
|
|||||||
@@ -91,7 +91,9 @@ var InternalClient = (function () {
|
|||||||
endpoint = data.d.endpoint;
|
endpoint = data.d.endpoint;
|
||||||
var chan = self.voiceConnection = new VoiceConnection(channel, self.client, session, token, server, endpoint);
|
var chan = self.voiceConnection = new VoiceConnection(channel, self.client, session, token, server, endpoint);
|
||||||
|
|
||||||
chan.on("ready", resolve);
|
chan.on("ready", function () {
|
||||||
|
return resolve(chan);
|
||||||
|
});
|
||||||
chan.on("error", reject);
|
chan.on("error", reject);
|
||||||
|
|
||||||
self.client.emit("debug", "removed temporary voice websocket listeners");
|
self.client.emit("debug", "removed temporary voice websocket listeners");
|
||||||
@@ -990,7 +992,7 @@ var InternalClient = (function () {
|
|||||||
request.patch(Endpoints.ME).set("authorization", self.token).send({
|
request.patch(Endpoints.ME).set("authorization", self.token).send({
|
||||||
avatar: self.resolver.resolveToBase64(data.avatar) || self.user.avatar,
|
avatar: self.resolver.resolveToBase64(data.avatar) || self.user.avatar,
|
||||||
email: data.email || self.email,
|
email: data.email || self.email,
|
||||||
new_password: data.new_password || null,
|
new_password: data.newPassword || null,
|
||||||
password: data.password || self.password,
|
password: data.password || self.password,
|
||||||
username: data.username || self.user.username
|
username: data.username || self.user.username
|
||||||
}).end(function (err) {
|
}).end(function (err) {
|
||||||
|
|||||||
@@ -743,6 +743,22 @@ class Client extends EventEmitter {
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// def leaveVoiceChannel
|
||||||
|
leaveVoiceChannel(callback = function (err) { }) {
|
||||||
|
var self = this;
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
self.internal.leaveVoiceChannel()
|
||||||
|
.then(() => {
|
||||||
|
callback();
|
||||||
|
resolve();
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
callback(err);
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Client;
|
module.exports = Client;
|
||||||
@@ -87,7 +87,7 @@ class InternalClient {
|
|||||||
endpoint = data.d.endpoint;
|
endpoint = data.d.endpoint;
|
||||||
var chan = self.voiceConnection = new VoiceConnection(channel, self.client, session, token, server, endpoint);
|
var chan = self.voiceConnection = new VoiceConnection(channel, self.client, session, token, server, endpoint);
|
||||||
|
|
||||||
chan.on("ready", resolve);
|
chan.on("ready", () => resolve(chan));
|
||||||
chan.on("error", reject);
|
chan.on("error", reject);
|
||||||
|
|
||||||
self.client.emit("debug", "removed temporary voice websocket listeners");
|
self.client.emit("debug", "removed temporary voice websocket listeners");
|
||||||
@@ -1058,7 +1058,7 @@ class InternalClient {
|
|||||||
.send({
|
.send({
|
||||||
avatar: self.resolver.resolveToBase64(data.avatar) || self.user.avatar,
|
avatar: self.resolver.resolveToBase64(data.avatar) || self.user.avatar,
|
||||||
email : data.email || self.email,
|
email : data.email || self.email,
|
||||||
new_password : data.new_password || null,
|
new_password : data.newPassword || null,
|
||||||
password : data.password || self.password,
|
password : data.password || self.password,
|
||||||
username : data.username || self.user.username
|
username : data.username || self.user.username
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user