mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
Accept user IDs as channels
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user