mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
Rename constructErrorCallback to errorCallback
to be more consistent with dataCallback.
This commit is contained in:
@@ -7,7 +7,7 @@ import PMChannel from "../Structures/PMChannel";
|
|||||||
// This utility function creates an anonymous error handling wrapper function
|
// This utility function creates an anonymous error handling wrapper function
|
||||||
// for a given callback. It is used to allow error handling inside the callback
|
// for a given callback. It is used to allow error handling inside the callback
|
||||||
// and using other means.
|
// and using other means.
|
||||||
function constructErrorCallback(callback) {
|
function errorCallback(callback) {
|
||||||
return error => {
|
return error => {
|
||||||
callback(error);
|
callback(error);
|
||||||
throw error;
|
throw error;
|
||||||
@@ -85,13 +85,13 @@ export default class Client extends EventEmitter {
|
|||||||
.then(token => {
|
.then(token => {
|
||||||
callback(null, token);
|
callback(null, token);
|
||||||
return token;
|
return token;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def logout
|
// def logout
|
||||||
logout(callback = (/*err*/) => { }) {
|
logout(callback = (/*err*/) => { }) {
|
||||||
return this.internal.logout()
|
return this.internal.logout()
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def destroy
|
// def destroy
|
||||||
@@ -113,7 +113,7 @@ export default class Client extends EventEmitter {
|
|||||||
.then(m => {
|
.then(m => {
|
||||||
callback(null, m);
|
callback(null, m);
|
||||||
return m;
|
return m;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def sendTTSMessage
|
// def sendTTSMessage
|
||||||
@@ -122,7 +122,7 @@ export default class Client extends EventEmitter {
|
|||||||
.then(m => {
|
.then(m => {
|
||||||
callback(null, m);
|
callback(null, m);
|
||||||
return m;
|
return m;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
// def reply
|
// def reply
|
||||||
reply(where, content, options = {}, callback = (/*e, m*/) => { }) {
|
reply(where, content, options = {}, callback = (/*e, m*/) => { }) {
|
||||||
@@ -141,7 +141,7 @@ export default class Client extends EventEmitter {
|
|||||||
.then(m => {
|
.then(m => {
|
||||||
callback(null, m);
|
callback(null, m);
|
||||||
return m;
|
return m;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
var err = new Error("Destination not resolvable to a message!");
|
var err = new Error("Destination not resolvable to a message!");
|
||||||
callback(err);
|
callback(err);
|
||||||
@@ -154,7 +154,7 @@ export default class Client extends EventEmitter {
|
|||||||
.then(m => {
|
.then(m => {
|
||||||
callback(null, m);
|
callback(null, m);
|
||||||
return m;
|
return m;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
// def deleteMessage
|
// def deleteMessage
|
||||||
deleteMessage(msg, options = {}, callback = (/*e*/) => { }) {
|
deleteMessage(msg, options = {}, callback = (/*e*/) => { }) {
|
||||||
@@ -164,7 +164,7 @@ export default class Client extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.internal.deleteMessage(msg, options)
|
return this.internal.deleteMessage(msg, options)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
//def updateMessage
|
//def updateMessage
|
||||||
updateMessage(msg, content, options = {}, callback = (/*err, msg*/) => { }) {
|
updateMessage(msg, content, options = {}, callback = (/*err, msg*/) => { }) {
|
||||||
@@ -177,7 +177,7 @@ export default class Client extends EventEmitter {
|
|||||||
.then(msg => {
|
.then(msg => {
|
||||||
callback(null, msg);
|
callback(null, msg);
|
||||||
return msg;
|
return msg;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def getChannelLogs
|
// def getChannelLogs
|
||||||
@@ -191,7 +191,7 @@ export default class Client extends EventEmitter {
|
|||||||
.then(logs => {
|
.then(logs => {
|
||||||
callback(null, logs);
|
callback(null, logs);
|
||||||
return logs;
|
return logs;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def getBans
|
// def getBans
|
||||||
@@ -200,7 +200,7 @@ export default class Client extends EventEmitter {
|
|||||||
.then(bans => {
|
.then(bans => {
|
||||||
callback(null, bans);
|
callback(null, bans);
|
||||||
return bans;
|
return bans;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def sendFile
|
// def sendFile
|
||||||
@@ -209,7 +209,7 @@ export default class Client extends EventEmitter {
|
|||||||
.then(m => {
|
.then(m => {
|
||||||
callback(null, m);
|
callback(null, m);
|
||||||
return m;
|
return m;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def joinServer
|
// def joinServer
|
||||||
@@ -218,7 +218,7 @@ export default class Client extends EventEmitter {
|
|||||||
.then(srv => {
|
.then(srv => {
|
||||||
callback(null, srv);
|
callback(null, srv);
|
||||||
return srv;
|
return srv;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def createServer
|
// def createServer
|
||||||
@@ -227,19 +227,19 @@ export default class Client extends EventEmitter {
|
|||||||
.then(srv => {
|
.then(srv => {
|
||||||
callback(null, srv);
|
callback(null, srv);
|
||||||
return srv;
|
return srv;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def leaveServer
|
// def leaveServer
|
||||||
leaveServer(server, callback = (/*err*/) => { }) {
|
leaveServer(server, callback = (/*err*/) => { }) {
|
||||||
return this.internal.leaveServer(server)
|
return this.internal.leaveServer(server)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def deleteServer
|
// def deleteServer
|
||||||
deleteServer(server, callback = (/*err*/) => { }) {
|
deleteServer(server, callback = (/*err*/) => { }) {
|
||||||
return this.internal.leaveServer(server)
|
return this.internal.leaveServer(server)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def createChannel
|
// def createChannel
|
||||||
@@ -252,13 +252,13 @@ export default class Client extends EventEmitter {
|
|||||||
.then(channel => {
|
.then(channel => {
|
||||||
callback(channel);
|
callback(channel);
|
||||||
return channel;
|
return channel;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def deleteChannel
|
// def deleteChannel
|
||||||
deleteChannel(channel, callback = (/*err*/) => { }) {
|
deleteChannel(channel, callback = (/*err*/) => { }) {
|
||||||
return this.internal.deleteChannel(channel)
|
return this.internal.deleteChannel(channel)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def banMember
|
//def banMember
|
||||||
@@ -269,19 +269,19 @@ export default class Client extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.internal.banMember(user, server, length)
|
return this.internal.banMember(user, server, length)
|
||||||
.then(() => {}, constructErrorCallback(callback));
|
.then(() => {}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def unbanMember
|
//def unbanMember
|
||||||
unbanMember(user, server, callback = (/*err*/) => { }) {
|
unbanMember(user, server, callback = (/*err*/) => { }) {
|
||||||
return this.internal.unbanMember(user, server)
|
return this.internal.unbanMember(user, server)
|
||||||
.then(() => {}, constructErrorCallback(callback));
|
.then(() => {}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def kickMember
|
//def kickMember
|
||||||
kickMember(user, server, callback = (/*err*/) => { }) {
|
kickMember(user, server, callback = (/*err*/) => { }) {
|
||||||
return this.internal.kickMember(user, server)
|
return this.internal.kickMember(user, server)
|
||||||
.then(() => {}, constructErrorCallback(callback));
|
.then(() => {}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def createRole
|
//def createRole
|
||||||
@@ -294,7 +294,7 @@ export default class Client extends EventEmitter {
|
|||||||
.then(role => {
|
.then(role => {
|
||||||
callback(null, role);
|
callback(null, role);
|
||||||
return role;
|
return role;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def updateRole
|
//def updateRole
|
||||||
@@ -307,19 +307,19 @@ export default class Client extends EventEmitter {
|
|||||||
.then(role => {
|
.then(role => {
|
||||||
callback(null, role);
|
callback(null, role);
|
||||||
return role;
|
return role;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def deleteRole
|
//def deleteRole
|
||||||
deleteRole(role, callback = (/*err*/) => { }) {
|
deleteRole(role, callback = (/*err*/) => { }) {
|
||||||
return this.internal.deleteRole(role)
|
return this.internal.deleteRole(role)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def addMemberToRole
|
//def addMemberToRole
|
||||||
addMemberToRole(member, role, callback = (/*err*/) => { }) {
|
addMemberToRole(member, role, callback = (/*err*/) => { }) {
|
||||||
return this.internal.addMemberToRole(member, role)
|
return this.internal.addMemberToRole(member, role)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def addUserToRole
|
// def addUserToRole
|
||||||
@@ -330,7 +330,7 @@ export default class Client extends EventEmitter {
|
|||||||
// def removeMemberFromRole
|
// def removeMemberFromRole
|
||||||
removeMemberFromRole(member, role, callback = (/*err*/) => { }) {
|
removeMemberFromRole(member, role, callback = (/*err*/) => { }) {
|
||||||
return this.internal.removeMemberFromRole(member, role)
|
return this.internal.removeMemberFromRole(member, role)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def removeUserFromRole
|
// def removeUserFromRole
|
||||||
@@ -341,7 +341,7 @@ export default class Client extends EventEmitter {
|
|||||||
//def addMemberToRole
|
//def addMemberToRole
|
||||||
addMemberToRoles(member, roles, callback = (/*err*/) => { }) {
|
addMemberToRoles(member, roles, callback = (/*err*/) => { }) {
|
||||||
return this.internal.addMemberToRoles(member, roles)
|
return this.internal.addMemberToRoles(member, roles)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def addUserToRole
|
// def addUserToRole
|
||||||
@@ -352,7 +352,7 @@ export default class Client extends EventEmitter {
|
|||||||
// def removeMemberFromRole
|
// def removeMemberFromRole
|
||||||
removeMemberFromRoles(member, roles, callback = (/*err*/) => { }) {
|
removeMemberFromRoles(member, roles, callback = (/*err*/) => { }) {
|
||||||
return this.internal.removeMemberFromRoles(member, roles)
|
return this.internal.removeMemberFromRoles(member, roles)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def removeUserFromRole
|
// def removeUserFromRole
|
||||||
@@ -371,19 +371,19 @@ export default class Client extends EventEmitter {
|
|||||||
return this.internal.createInvite(chanServ, options)
|
return this.internal.createInvite(chanServ, options)
|
||||||
.then(invite => {
|
.then(invite => {
|
||||||
callback(null, invite);
|
callback(null, invite);
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def deleteInvite
|
// def deleteInvite
|
||||||
deleteInvite(invite, callback = (/*err*/) => { }) {
|
deleteInvite(invite, callback = (/*err*/) => { }) {
|
||||||
return this.internal.deleteInvite(invite)
|
return this.internal.deleteInvite(invite)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def overwritePermissions
|
// def overwritePermissions
|
||||||
overwritePermissions(channel, role, options = {}, callback = (/*err*/) => { }) {
|
overwritePermissions(channel, role, options = {}, callback = (/*err*/) => { }) {
|
||||||
return this.internal.overwritePermissions(channel, role, options)
|
return this.internal.overwritePermissions(channel, role, options)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def setStatus
|
//def setStatus
|
||||||
@@ -398,73 +398,73 @@ export default class Client extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.internal.setStatus(idleStatus, gameID)
|
return this.internal.setStatus(idleStatus, gameID)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def sendTyping
|
//def sendTyping
|
||||||
sendTyping(channel, callback = (/*err*/) => { }) {
|
sendTyping(channel, callback = (/*err*/) => { }) {
|
||||||
return this.internal.sendTyping(channel)
|
return this.internal.sendTyping(channel)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def setTopic
|
// def setTopic
|
||||||
setChannelTopic(channel, topic, callback = (/*err*/) => { }) {
|
setChannelTopic(channel, topic, callback = (/*err*/) => { }) {
|
||||||
return this.internal.setChannelTopic(channel, topic)
|
return this.internal.setChannelTopic(channel, topic)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def setChannelName
|
//def setChannelName
|
||||||
setChannelName(channel, name, callback = (/*err*/) => { }) {
|
setChannelName(channel, name, callback = (/*err*/) => { }) {
|
||||||
return this.internal.setChannelName(channel, name)
|
return this.internal.setChannelName(channel, name)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def setChannelNameAndTopic
|
//def setChannelNameAndTopic
|
||||||
setChannelNameAndTopic(channel, name, topic, callback = (/*err*/) => { }) {
|
setChannelNameAndTopic(channel, name, topic, callback = (/*err*/) => { }) {
|
||||||
return this.internal.setChannelNameAndTopic(channel, name, topic)
|
return this.internal.setChannelNameAndTopic(channel, name, topic)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def setChannelPosition
|
//def setChannelPosition
|
||||||
setChannelPosition(channel, position, callback = (/*err*/) => { }) {
|
setChannelPosition(channel, position, callback = (/*err*/) => { }) {
|
||||||
return this.internal.setChannelPosition(channel, position)
|
return this.internal.setChannelPosition(channel, position)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def updateChannel
|
//def updateChannel
|
||||||
updateChannel(channel, data, callback = (/*err*/) => { }) {
|
updateChannel(channel, data, callback = (/*err*/) => { }) {
|
||||||
return this.internal.updateChannel(channel, data)
|
return this.internal.updateChannel(channel, data)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def startTyping
|
//def startTyping
|
||||||
startTyping(channel, callback = (/*err*/) => { }) {
|
startTyping(channel, callback = (/*err*/) => { }) {
|
||||||
return this.internal.startTyping(channel)
|
return this.internal.startTyping(channel)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def stopTyping
|
//def stopTyping
|
||||||
stopTyping(channel, callback = (/*err*/) => { }) {
|
stopTyping(channel, callback = (/*err*/) => { }) {
|
||||||
return this.internal.stopTyping(channel)
|
return this.internal.stopTyping(channel)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def updateDetails
|
//def updateDetails
|
||||||
updateDetails(details, callback = (/*err*/) => { }) {
|
updateDetails(details, callback = (/*err*/) => { }) {
|
||||||
return this.internal.updateDetails(details)
|
return this.internal.updateDetails(details)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def setUsername
|
//def setUsername
|
||||||
setUsername(name, callback = (/*err*/) => { }) {
|
setUsername(name, callback = (/*err*/) => { }) {
|
||||||
return this.internal.setUsername(name)
|
return this.internal.setUsername(name)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def setAvatar
|
//def setAvatar
|
||||||
setAvatar(avatar, callback = (/*err*/) => { }) {
|
setAvatar(avatar, callback = (/*err*/) => { }) {
|
||||||
return this.internal.setAvatar(avatar)
|
return this.internal.setAvatar(avatar)
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
//def joinVoiceChannel
|
//def joinVoiceChannel
|
||||||
@@ -473,13 +473,13 @@ export default class Client extends EventEmitter {
|
|||||||
.then(chan => {
|
.then(chan => {
|
||||||
callback(null, chan);
|
callback(null, chan);
|
||||||
return chan;
|
return chan;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def leaveVoiceChannel
|
// def leaveVoiceChannel
|
||||||
leaveVoiceChannel(callback = (/*err*/) => { }) {
|
leaveVoiceChannel(callback = (/*err*/) => { }) {
|
||||||
return this.internal.leaveVoiceChannel()
|
return this.internal.leaveVoiceChannel()
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
// def awaitResponse
|
// def awaitResponse
|
||||||
@@ -517,17 +517,17 @@ export default class Client extends EventEmitter {
|
|||||||
.then(newMsg => {
|
.then(newMsg => {
|
||||||
callback(null, newMsg);
|
callback(null, newMsg);
|
||||||
return newMsg;
|
return newMsg;
|
||||||
}, constructErrorCallback(callback));
|
}, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
setStatusIdle(callback = (/*err*/) => { }) {
|
setStatusIdle(callback = (/*err*/) => { }) {
|
||||||
return this.internal.setStatus("idle")
|
return this.internal.setStatus("idle")
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
setStatusOnline(callback = (/*err*/) => { }) {
|
setStatusOnline(callback = (/*err*/) => { }) {
|
||||||
return this.internal.setStatus("online")
|
return this.internal.setStatus("online")
|
||||||
.then(callback, constructErrorCallback(callback));
|
.then(callback, errorCallback(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
setStatusActive(callback) {
|
setStatusActive(callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user