mirror of
https://github.com/danbulant/discord.js
synced 2026-07-06 19:50:55 +00:00
Accept user IDs as channels
This commit is contained in:
parent
ea80677a79
commit
14fffb12af
2 changed files with 12 additions and 2 deletions
|
|
@ -286,7 +286,12 @@ var Resolver = (function () {
|
||||||
return Promise.resolve(resource.defaultChannel);
|
return Promise.resolve(resource.defaultChannel);
|
||||||
}
|
}
|
||||||
if (resource instanceof String || typeof resource === "string") {
|
if (resource instanceof String || typeof resource === "string") {
|
||||||
return Promise.resolve(this.internal.channels.get("id", resource) || this.internal.private_channels.get("id", resource));
|
var user = this.internal.users.get("id", resource);
|
||||||
|
if (user) {
|
||||||
|
resource = user;
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(this.internal.channels.get("id", resource) || this.internal.private_channels.get("id", resource));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (resource instanceof _StructuresUser2["default"]) {
|
if (resource instanceof _StructuresUser2["default"]) {
|
||||||
// see if a PM exists
|
// see if a PM exists
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,12 @@ export default class Resolver {
|
||||||
return Promise.resolve(resource.defaultChannel);
|
return Promise.resolve(resource.defaultChannel);
|
||||||
}
|
}
|
||||||
if (resource instanceof String || typeof resource === "string") {
|
if (resource instanceof String || typeof resource === "string") {
|
||||||
return Promise.resolve(this.internal.channels.get("id", resource) || this.internal.private_channels.get("id", resource));
|
var user = this.internal.users.get("id", resource);
|
||||||
|
if (user) {
|
||||||
|
resource = user;
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(this.internal.channels.get("id", resource) || this.internal.private_channels.get("id", resource));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (resource instanceof User) {
|
if (resource instanceof User) {
|
||||||
// see if a PM exists
|
// see if a PM exists
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue